Re: Korn shell question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15Apr2008 12:09, Don Russell <fedora@xxxxxxxxxxxxxxxxxxxxx> wrote:
| On Tue, Apr 15, 2008 at 11:08 AM, Patrick O'Callaghan <pocallaghan@xxxxxxxxx>
| 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
| > and work from there.
| 
| That looks promising... thanks :-)

Promising, but will work only on Linux. That may be enough for you, but you
shouldn't forget that it's nonportable.

You can probably make that `cat|grep|cut` into a single `sed` at some
performance benefit.

Another approach is to alter your shell environment to always set and export
an environment variable when starting vi (by invoking vi via a wrapper script
or alias or shell function) and then just checking for it.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Love ...yeah, that's the feeling you get when you like something as much as
your motorcycle.        - Sonny Barger (as told to Russ Hughes by Ed Campbell,
                              who has an old friend who was there at the time)

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux