Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!vsi1!wyse!bob From: bob@wyse.wyse.com (Bob McGowen x922-4312 Training) Newsgroups: comp.unix.questions Subject: Re: Forcing /bin/sh in a script under V/386 3.2 Korn shell Message-ID: <2328@wyse.wyse.com> Date: 25 Jul 89 00:06:23 GMT References: <2318@wyse.wyse.com> <799@jonlab.UUCP> Sender: news@wyse.wyse.com Reply-To: bob@wyse.UUCP (Bob McGowen x922-4312 Training) Organization: Wyse Technology Lines: 38 In article <799@jonlab.UUCP> jon@jonlab.UUCP (Jon H. LaBadie) writes: >In article <2318@wyse.wyse.com>, bob@wyse.wyse.com writes: > ... Much deleted ... >> ---more delted--- >Now a question for Bob. Can you let me know the need for the > > `whence $0` > >construction in your solution. On inspection, it seems that $0 would >be sufficient as the script was invoked that way to begin with. But >I am certain I am overlooking some subtle situation in which that >is not the case. >-- >Jon LaBadie >{att, princeton, bcr}!jonlab!jon >{att, attmail, bcr}!auxnj!jon In my experience, when you invoke the Bourne shell on the command line to run a script, the PATH is not consulted. For example, _cx_, which is in my personnal bin, which is part of my path, will generate the error: cx: cx: cannot open when I run it via: sh cx I wanted to generate the absolute pathname of the script so I could give it to sh to run, thereby guaranteeing(sp?) that sh would find the script. This may of course not be the case with all versions of sh. My experience is with XENIX and SUN versions (I can get at these right now:-) Bob McGowan (standard disclaimer, these are my own ...) Customer Education, Wyse Technology, San Jose, CA ..!uunet!wyse!bob bob@wyse.com