Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get full command line, not just argv

Status
Not open for further replies.

TheIrishThug

Programmer
Apr 6, 2007
2
US
I am piping information into my tcl script ([some command]|my_script.tcl). Is there a way to get the entire string that was used to start the task?
 
If you mean the original string, the answer is no.
But if you only want the original arguments of the command,
you have access to some global variables:

argc
The number of arguments to tclsh or wish.
argv
Tcl list of arguments to tclsh or wish.
argv0
The script that tclsh or wish started executing (if it was specified) or otherwise the name by which tclsh or wish was invoked.

So you can have an equivalent of the original command with:
Code:
  set cmd "$::argv0 [join $::argv]"

Some pages about tclsh and the args:

HTH

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top