I want to do something like this:
if cmd1 && cmd2
echo success
else
echo epic fail
fi
How should I do it?
|
I want to do something like this:
How should I do it? |
|||||||||
|
|
These should do what you need:
or
|
|||
|
|
|
Petr Uzel is spot on but you can also play with the magic $?. $? holds the exit code from the last command executed, and if you use this you can write your scripts quite flexible. This questions touches this topic a little bit, Best practice to use $? in bash? .
Then you also can react to different exit codes and do different things if you like. |
|||
|
|