bash script

Occasionally I need to write bash scripts and just wanted to jot down some notes that are helpful when doing that.

The first line of the script should read
 #!/bin/bash

And then you can check the number of command line arguments that are passed into the script with
$#
and then the arguments can be accessed by using
$1 or $2, etc.
and the name of the script can be accessed with
$0
and finally, all the command line arguments can be accessed with
$@

No comments: