Re: How to escape this?



At Mon, 19 May 2008 05:48:02 -0700 (PDT) Why Tea <ytlim1@xxxxxxxxx> wrote:


On May 19, 2:27 pm, Alexandre Ferrieux <alexandre.ferri...@xxxxxxxxx>
wrote:
On May 19, 2:25 pm, Why Tea <ytl...@xxxxxxxxx> wrote:

Here is a shell command to find the current shell: ps -p $$ | tail -1
| awk '{print $NF}'.

How do you execute this in Tcl and get the output?

/Why Tea

Since the line is full of unix shellisms, feed it untouched to the
unix shell ;-)

exec sh -c {ps -p $$ | tail -1 | awk '{print $NF}'} 2>@ stderr

-Alex

Thanks Alex. It works. While it's working, it doesn't give me
the answer I want. My intention was to find out which shell
was used to launch tclsh or wish? E.g. if tclsh/wish is run
in tclsh, the command will give me "sh". Any idea of how to
get the original shell?

Did you try [info nameofexecutable] ?



--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller@xxxxxxxxxxxx -- Contract Programming: C/C++, Tcl/Tk

.



Relevant Pages

  • Re: How to escape this?
    ... | awk ''. ... Since the line is full of unix shellisms, ... My intention was to find out which shell ... was used to launch tclsh or wish? ...
    (comp.lang.tcl)
  • Re: How to escape this?
    ... Why Tea wrote: ... Since the line is full of unix shellisms, ... My intention was to find out which shell ... was used to launch tclsh or wish? ...
    (comp.lang.tcl)
  • Re: How to escape this?
    ... Since the line is full of unix shellisms, ... My intention was to find out which shell ... So here you can add 'tail -1' instead of ... my lousy lrange whose only goal in life was to avoid forking a ...
    (comp.lang.tcl)
  • Re: How to escape this?
    ... Any idea of how to get the original shell? ... You need to take the wish/tclsh pid, scan the 'ps' output for the ... parent process id, and then scan the ps output again ...
    (comp.lang.tcl)
  • Re: How to escape this?
    ... Since the line is full of unix shellisms, ... My intention was to find out which shell ... in tclsh, the command will give me "sh". ... Geralds-Computer:Car gerald$ echo $SHELL ...
    (comp.lang.tcl)