Please help me writing a shell programming using if
else
, all possibile code using [[ ]]
, [ ]
, (( ))
.
I tried but it does not work (you can check my previous question Arithmetic binary operators -gt, -lt give error but work in a shell script).
Here is the C version:
int i = 10, n = 20;
if (i < n)
printf("i smaller");
else if (i > n)
printf("n smaller");
else
printf("same");
What about
second...
and last one...
I have the following script to make sure some services stay up. It also does a mysql backup everyday, checks for services online and if not they go up again, etc.. Not my best work but gives you an idea on how to use IF and the same goes for ELSE IF:
Like I said, not the best but gets the job done.