Paramaters: Difference between revisions

From KlavoWiki
Jump to navigationJump to search
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...'
 
 
(No difference)

Latest revision as of 00:18, 23 March 2009

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