Re: ID shell and process

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Gerald Thurman
Date:  
To: Main PLUG discussion list
Subject: Re: ID shell and process
It should be noted that the 'ps | grep $$' command-line,
without any anchoring on the grep pattern, could result
in multiple lines of output.

On 8/2/07, der.hans <> wrote:
>
> Am 02. Aug, 2007 schwätzte Jon M. Hanson so:
>
> > der.hans wrote:
> >> moin moin,
> >>
> >> a question on another list about determining which shell is currently
> >> being used led to some nice answers.
> >>
> >> I thought I'd post some here in that the answers might not only be
> useful,
> >> but might lead to learning more about how things work.
> >>
> >> ls -l /proc/$$/exe
> >> readlink /proc/$$/exe
> >> cat /proc/$$/cmdline
> >> ps -p $$
> >> ps | grep $$
> >>
> >> If you haven't wandered around in proc you should check it out. If you
> >> have, you should likely look again :).
> >>
> >> /me looks again.
> >>
> >> ciao,
> >>
> >> der.hans
> >>
> > Another one is echo $0.
>
> Yup. That had been mentioned, but I forgot to add it to my email. I'm glad
> that someone thought about the post :).
>
> echo $SHELL was mentioned, but that one is actually unreliable when you
> have shells within shells.
>
> All of the others can also be unreliable in that things might not be
> called what you think, but they should generally give you information
> about how the current process was called.
>
> ln /bin/fredsownshell /bin/bash
> exec /bin/fredsownshell
>
> :)
>
> ciao,
>
> der.hans
> --
> #  https://www.LuftHans.com/        http://www.CiscoLearning.org/
> #  "It is a miracle that curiosity survives formal education."
> #   -- Albert Einstein
> ---------------------------------------------------
> PLUG-discuss mailing list - 
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

>

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss