ID shell and process

der.hans PLUGd at LuftHans.com
Thu Aug 2 13:25:48 MST 2007


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


More information about the PLUG-discuss mailing list