我有以下情况。如果满足所有条件,则通过。如果失败,则需要知道是哪种情况导致失败?
if [[ -z “$pas” ]] && [[ $dd_check_pass == “pass” ]] && [[ $asmresultcheck == “pass” ]];
then
zzz=Passed;
else
zzz=Failed;
aaa=”Due to unknown process running”
fi
答案 0 :(得分:1)
如果您需要了解哪种情况失败,则需要对每个情况单独采取行动:
class CommandProduct
{
/**
* @var int $id
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var Command $contain
*
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Command", inversedBy="contains")
* @ORM\JoinColumn(name="command_id", referencedColumnName="id", nullable=false)
*/
private $contain;
/**
* @var int $quantity
*
* @ORM\Column(name="quantity", type="integer", nullable=true, options={"default": 1})
* @Assert\NotBlank()
* @Assert\Type(type="int")
*/
private $quantity;
/**
* @var Product $product
*
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Product")
* @ORM\JoinColumn(name="product_id", referencedColumnName="id")
*/
private $product;
}
答案 1 :(得分:0)
pass=""
dd_check_pass="pass"
asmresultcheck="pass"
var=pass
case $var in
pass)
if [[ -z $pasrep ]]
then
echo "\n"
echo "users condition Passed"
else
echo "\n"
echo "users condition failed"
fi
;&
dd_check_pass)
if [[ $dd_check_pass == "pass" ]]
then
echo "\n"
echo "cluster check passed"
else
echo "\n"
echo "cluster check failed"
fi
;&
asmresultcheckin)
if [[ $asmresultcheck == "pass" ]]
then
echo "\n"
echo "asm check passed"
else
echo "\n"
echo "asm check failed"
fi
;&
esac
echo "\n"
echo "Check the above result. If all are passed then proceed with duedeligence or else don't proceed. Do you wish to proceed (y/n)?"
read ans
if [ $ans == y ]
then
echo "\n"
echo "passed"
else
echo "\n"
echo "failed"
fi