This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Cmd line arg help in stp
- From: Varun Chandramohan <varunc at linux dot vnet dot ibm dot com>
- To: systemtap at sources dot redhat dot com
- Date: Mon, 06 Apr 2009 12:24:05 +0530
- Subject: Cmd line arg help in stp
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