Korn shell question

Bill Davidsen davidsen at tmr.com
Wed Apr 16 14:41:33 UTC 2008


Patrick O'Callaghan wrote:
> On Tue, 2008-04-15 at 10:49 -0700, Don Russell wrote:
>> How can I tell, from a Korn shell script, if the script is running in
>> a vi sub-shell?
>>
>> I have a script that has a problem when run from a vi subshell, and
>> I'd like to check for that condition and just issue an error message.
>> (I know that's not the solution to the problem, but the thing that
>> fails is being replaced, so this is a temporary "fix")
> 
> Try:
> 
> ls -l /proc/`cat /proc/$$/status|grep PPid|cut -f2`/exe

What on Earth are you doing here?
1) unless you have some reason to doubt the value of $PPID, you are just
    making this look complex
2) if this is a login shell, you will not have permission to read the
    exe symbolic link.
3) you probably just want to see if /proc/$PPIC/cmdline matches vi

> 
> and work from there.
> 
> poc
> 


-- 
Bill Davidsen <davidsen at tmr.com>
   "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot




More information about the fedora-list mailing list