How to add Usage Functionality in script?

In Linux, you need to work with many bash scripts. Many times adding usage functionality in script is very useful it remind you how to use script like passing the arguments to script to make it work.



[ $# -eq 0 ] && { echo "Usage: $0 username"; exit 1; }

The above line will verify the enlargements passed to scripts, otherwise exit with error code 1.

Labels: