This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cmd line arg help in stp


Varun Chandramohan <varunc@linux.vnet.ibm.com> writes:

> Iam looking at a way to iterate the multiple command line
> arguments i passed with my script.
>[...]
> 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

This just works:

probe begin {
      for (i=1; i<argc; i++)
          log(argv[i])
}

However, we don't have many string processing functions yet, so
parsing each parameter at run time is  clunky.

- FChE


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]