Is it possible with bash to execute a command from shell and if it returns a certain value (or an empty one) execute a command?
if [ "echo test" == "test"]; then
echo "echo test outputs test on shell"
fi
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you can use backticks or
$()syntax:You should replace
$(echo test)withor
if the output of the command you run can be empty.
And the POSIX “stings are equal”
testoperator is=.