Showing posts with label shell. Show all posts
Showing posts with label shell. Show all posts

Friday, 15 June 2012

Common shell scripts

if statement

The most compact syntax of the if command is:
if TEST-COMMANDS; then CONSEQUENT-COMMANDS; fi
The TEST-COMMAND list is executed, and if its return status is zero, the CONSEQUENT-COMMANDS list is executed. The return status is the exit status of the last command executed, or zero if no condition tested true. Expression used with if

  • [-s FILE]: True if FILE exists and has a size greater than zero.