[comp.unix.shell] A few questions

fenn@wpi.WPI.EDU (Brian Fennell) (12/12/90)

There was a question about .logout for bash... any idea how to fudge
it with ksh?

Also:
I have been on a few network systems where I have a diferent shell
depending on what maghine I login to, but all the same files.  I
finnally got sick of rewriting both .login and .profile and made one a
link to the other, and added a test on $SHELL and a few aliases to
fake out csh and ksh into acting the same for varable assignment.
The question\chalange: what is the best way to do this so it will work
for all the shells I might run into. including aliases if-thens 
and variable assignment (I have a feeling the answer might be:
exec c_prog_login)

third:
has there ever been such a thing as a bourn-script compiler?

knott@Informatik.TU-Muenchen.DE (Thomas Knott) (12/14/90)

In article <1990Dec11.202750.2435@wpi.WPI.EDU>, fenn@wpi.WPI.EDU (Brian Fennell) writes:

...
|> Also:
|> I have been on a few network systems where I have a diferent shell
|> depending on what maghine I login to, but all the same files.  I
|> finnally got sick of rewriting both .login and .profile and made one a
|> link to the other, and added a test on $SHELL and a few aliases to
|> fake out csh and ksh into acting the same for varable assignment.
|> The question\chalange: what is the best way to do this so it will work
|> for all the shells I might run into. including aliases if-thens 
|> and variable assignment (I have a feeling the answer might be:
|> exec c_prog_login)
...

If the first line in your shell script looks like

#!/bin/sh

then the shell processing your script is the Bourne-shell sh, which should
be in /bin. This also works in the .login, .logout and .profile, I guess.

	Tom

--
Thomas Knott				knott@informatik.tu-muenchen.de

jik@athena.mit.edu (Jonathan I. Kamens) (12/17/90)

In article <1990Dec13.182425@Informatik.TU-Muenchen.DE>, knott@Informatik.TU-Muenchen.DE (Thomas Knott) writes:
|> If the first line in your shell script looks like
|> 
|> #!/bin/sh
|> 
|> then the shell processing your script is the Bourne-shell sh, which should
|> be in /bin. This also works in the .login, .logout and .profile, I guess.

  To be blunt, get a clue.  Or, at the very least, actually TRY things you're
not sure about before you post messages like this to the net.

  No, this will NOT work.  The .login and .profile files are executed WITHIN
the login shell, not in a subshell.  They are not invoked as separate
processes, which is when the #! notation takes effect, they are read and
executed within the shell that is reading them.

  Just think about this for a minute.  The stuff in your .login or .profile
file is supposed to affect your login shell.  If the #! notation in .login or
profile were to work, then it would cause the .login or .profile file to be
executed in a separate shell, i.e. a separate process, which means that the
commands executed would NOT affect the login shell.  This sort of defeats most
of the purpose of .login or .profile.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710