For instance:
if $input = 'y'
causes
./test.sh: line 5: y: command not found
While
if [ $tmp = 'y' ]
causes no error?
What is the purpose of an if statement that cannot evaluate conditions?
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.
ifdoesn’t evaluate anything. It simply executes the predicate program and acts on its return code.[is actually a program that does a handful of conditions, and returns an appropriate return code.[can be used with oneliners without if, if you don’t need theelsebranch: