case 1 : suppose I am passing a number of parameters to my shell script as follows :
./myshell_script a b c d
and if I run echo $#
will give me number of parameters from command line I have passed and I stored it in a variable like [ since I dont know number of arguments a user is passing ]:
var1 = `echo "$#"`
case 2 : $4 gives me the name of last argument .
if i want it to store in
var2 then
var2 = $4
My question is :
If I want to store value I get from var1 to var2 directly , how would be it possible in shell script ?
for ex :
./myshell_script.sh a b c
var1 = `echo "$#"` ie var1 = 3
now I want
var2 = c [ ie always last parameter , since I dont know how many number of parameters user is passing from comand line ]
what I have to do ?