Cmd line arg help in stp

Varun Chandramohan varunc@linux.vnet.ibm.com
Mon Apr 6 06:54:00 GMT 2009


Hi,

       Iam looking at a way to iterate the multiple command line 
arguments i passed with my script.

#stap xyz.stp <arg 1> <arg2> <arg3>

arc are strings. '$#' gives me the max number of arguments passed and 
'$1' , '$2' .... gives each of the args. But the number of args iam 
passing to the script is not fixed.

Can somone help me with writing a sample code in system tap that can do 
this? I need something similar to what the below script does

while [ $# -gt 0 ]
do

   echo $1
   shift

done

or in c we have argc and argv []. Any suggestions? Iam new to stap 
scripting so please suggest a method to do this or point me to some code 
that already does something similar. Thanks.

Regards,
Varun



More information about the Systemtap mailing list