Paramaters

From KlavoWiki
Revision as of 00:16, 23 March 2009 by David (talk | contribs) (Created page with 'If you require to check for any paramaters when the BASH script is executed, you can check for $1, $2 .... etc. <pre> if [ $1 = "whatever" ] then . . . . fi </pre> If no...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

If you require to check for any paramaters when the BASH script is executed, you can check for $1, $2 .... etc.

if [ $1 = "whatever" ]
then
  .
  .
  .
  .
fi

If no paramatres are specified

if [ -z $1 ];
then
  .
  .
  .
  .
fi