Arguments
<<<< ^^^^^ >>>>

printmyargs.sh
#!/bin/bash
echo arg0 is $0, arg1 is $1, and arg2 is $2
   
printallargs.sh
#!/bin/bash
echo -n arg0 is $0
argno=1
for arg in $@; do
echo -n ", "arg$argno is $arg
let argno=$argno+1
done
echo

test.sh
#!/bin/bash
./printmyargs.sh one two three
./printallargs.sh one two three

<<<< ^^^^^ >>>>

 
 
 
 
Copyright (C) 2005 by Steve Litt, you can freely distribute unmodified copies if this copyright notice and disclaimer are intact.  This material originally appeared on Troubleshooters.Com.

This presentation has no warranty, express or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the presentation is with you. Neither the author nor those who show the slideshow are responsible for any damage caused by errors, omissions, or anything else relating to this slideshow.
 

12.html

Exit Slideshow