Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!emory!hubcap!ncrcae!ncrlnk!ncrcce!mercer From: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) Newsgroups: comp.unix.wizards Subject: SYS V Bourne Shell .shrc file Message-ID: <1792@ncrcce.StPaul.NCR.COM> Date: 22 Dec 89 00:00:52 GMT Reply-To: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) Organization: NCR Comten, Inc. Lines: 41 Keywords: While hacking around trying to include some difficult functionality for a program I was writing, I examined /bin/sh with a binary display program looking for undocumented options. Instead, I ran into the string .shrc. Intrigued, I quickly formulated a .shrc file in my home directory to echo Hello, world!. After that, when I forked to the shell, I got the message, providing it was an interactive shell (if you pipe to the shell, for instance to unshar a file, or using the vi !! command, it is not invoked). The .shrc is also invoked prior to /etc/profile and ~/.profile on login. Since I use my .shrc to invoke my shell functions and much of the functionality that I already do in .profile, I check for the existence of a shell environment variable I set in .profile and only execute it if it already exists. Of course, as with .profile, do not place any exits in the file. I am system administer on two boxes, so I use my prompt to indicate which box I'm on, what line, the depth of my shell nesting, and my current working directory. Really cuts down on the confusion, since I'm frequently on both boxes simultaneously, often on multiple lines (we're testing out Token Ring software connecting the two boxes, so I may be kermitted from one box to the other over a direct asynch line, the nloginned back to the original box via Token Ring. One of the truly wonderful things, it's invoked under su as well. I just check to see if PS1 == '# ' (don't forget space), I reset my path to something reasonable, instead of the annoying and insecure :/etc:/bin:/usr/bin. I already know this capability does not exist on SUN OS3.5. Other SYSV users, let me know if you have it. Our system consists of two NCR Towers running SYSVR1 and SYSVR2 and I have confirmed it's existence on another Tower running SYSVR3.2. -- Dan Mercer Reply-To: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer)