I have been using if conditions in shell script from long time as shown below:
if [ CONDITION ] then some commands here. fi
But when we write if condition as a one liner it’s bit tricky. We need to specify “;” in right places.
Following is an example to use if as one liner:
$ if [ condition ]; then echo "some function here"; fi
-Sany
Advertisements