rick@zeek.UUCP (Rick Wilhelm) (10/17/89)
Yesterday, while trying to get xterm to run ksh with a startup file (to set up the aliases, etc). I found out that there seems to be no way to have ksh run a script file upon startup (a la csh and .cshrc). So my questions are these: 1) Is there a way to run ksh with a startup script and then turn things over to stdin and the $ prompt, etc.? 2) If the answer to 1) is "yes" then "how do I do it?" 3) If the answer to 1) if "no" then "why not?" I understand that .cshrc is a BSDism, and thus could not have been adopted by sh. But why didn't ksh acquire this useful feature. Thanks, rick -- ------------------------------------------------------------------------------- Rick Wilhelm uunet!zeek!rick Andersen Consulting 312-715-5471 Advanced Systems Center, Chicago
cpcahil@virtech.UUCP (Conor P. Cahill) (10/17/89)
In article <262@zeek.UUCP>, rick@zeek.UUCP (Rick Wilhelm) writes: > 1) Is there a way to run ksh with a startup script and > then turn things over to stdin and the $ prompt, etc.? Yes. place the name of the script into the $ENV environment variable and all sub-kshell will run it. I usually place all of my shell functions and aliases into a ".ksh.profile" and include the following code in my .profile: ENV=$HOME/.ksh.profile export ENV . $ENV -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+
gow@mrsvr.UUCP (Ed Gow) (10/17/89)
From article <262@zeek.UUCP>, by rick@zeek.UUCP (Rick Wilhelm): > > Yesterday, while trying to get xterm to run ksh with a startup file > (to set up the aliases, etc). I found out that there seems to be no way > to have ksh run a script file upon startup (a la csh and .cshrc). > > So my questions are these: > > 1) Is there a way to run ksh with a startup script and > then turn things over to stdin and the $ prompt, etc.? Yes, set the shell variable ENV to a file name (i.e. .kshrc). Be sure to export ENV so subshells get it. This should all be in your document :^} The above is null and void if you are using a malformed mutant version.
barmar@kulla (Barry Margolin) (10/18/89)
In article <1287@virtech.UUCP> cpcahil@virtech.UUCP (Conor P. Cahill) writes: >In article <262@zeek.UUCP>, rick@zeek.UUCP (Rick Wilhelm) writes: >> 1) Is there a way to run ksh with a startup script and >> then turn things over to stdin and the $ prompt, etc.? >Yes. place the name of the script into the $ENV environment variable >and all sub-kshell will run it. How do you arrange for $ENV to get set if the shell isn't a descendent of a login shell? For instance, shells started by "rsh" aren't login shells. Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar
davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) (10/18/89)
In article <262@zeek.UUCP>, rick@zeek.UUCP (Rick Wilhelm) writes: | So my questions are these: | | 1) Is there a way to run ksh with a startup script and | then turn things over to stdin and the $ prompt, etc.? The file is called .profile as described in the manual. If you have two ids which go into the same directory but with diferent shells (I do that) and you have ksh stuff which won't work for sh, put the simple stuff in .profile and end .profile with a statement: ENV=~/.kshrc Then put the ksh speciffic stuff in the .kshrc file. -- bill davidsen (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen) "The world is filled with fools. They blindly follow their so-called 'reason' in the face of the church and common sense. Any fool can see that the world is flat!" - anon
dts@quad.uucp (David T. Sandberg) (10/18/89)
In article <262@zeek.UUCP> rick@zeek.UUCP (Rick Wilhelm) writes: > .cshrc is a BSDism, and thus could not have been adopted by sh. > But why didn't ksh acquire this useful feature. Hmm. My ksh (3b1 UNIX 3.51) utilizes a .kshrc file in the expected fashion. Perhaps not all versions of ksh do, though? -- David Sandberg - Quadric Systems "I began neglecting my shoes." PSEUDO: dts@quad.uucp ACTUAL: ..uunet!rosevax!sialis!quad!dts
gwyn@smoke.BRL.MIL (Doug Gwyn) (10/19/89)
In article <30996@news.Think.COM> barmar@kulla (Barry Margolin) writes: >How do you arrange for $ENV to get set if the shell isn't a descendent >of a login shell? For instance, shells started by "rsh" aren't login >shells. I general solve problems like this by telling rsh to invoke the "env" command on the remote end (with appropriate arguments). If you don't have "env" or equivalent, that's YOUR problem :-).