Consider the following code..
Code:
1 #!/bin/bash
2
3 count=1
4 for param in "$*"
5 do
6 echo "\$* Parameter #$count = $param"
7 count=$[ $count + 1 ]
8 done
9
10 count=1
11 for param in "$@"
12 do
13 echo "\$@ Parameter #$count = $param"
14 count=$[ $count + 1 ]
15 done
Here $* variable takes all of the parameters supplied on the command line as a single word and $@ variable takes all the parameters supplied on the command line as separate words in the same string.
Quote:
[user31@FEDORA ~]$ ./last1.sh asit qutub sunil chusa ruplina
The last parameter is 5
The last parameter is ruplina
|
But why the op is same as required in my system ??
My system is
Quote:
[user31@FEDORA ~]$ uname -a
Linux FEDORA 2.6.9-1.667 #1 Tue Nov 2 14:41:25 EST 2004 i686 i686 i386 GNU/Linux
|