Thread View: comp.unix.shell
8 messages
8 total messages
Started by Brian Fennell
Tue, 11 Dec 1990 20:27
A few questions
Author: Brian Fennell
Date: Tue, 11 Dec 1990 20:27
Date: Tue, 11 Dec 1990 20:27
16 lines
1066 bytes
1066 bytes
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?
.logout functionality using ksh <was: A few questions>
Author: Ray Shwake
Date: Wed, 12 Dec 1990 15:31
Date: Wed, 12 Dec 1990 15:31
12 lines
845 bytes
845 bytes
fenn@wpi.WPI.EDU (Brian Fennell) writes: >There was a question about .logout for bash... any idea how to fudge >it with ksh? The approach I've used successfully involves trapping the logout signal (signal 0). Example: trap 'tput clear; exit' EXIT I use this under SCO and ISC UNIX, among others. On some systems, the EXIT reference is not recognized, so use 0 instead.
Re: .logout functionality using ksh <was: A few questions>
Author: Wm E. Davidsen Jr
Date: Thu, 13 Dec 1990 15:38
Date: Thu, 13 Dec 1990 15:38
24 lines
1456 bytes
1456 bytes
In article <175@raysnec.UUCP> shwake@raysnec.UUCP (Ray Shwake) writes:
| The approach I've used successfully involves trapping the logout
| signal (signal 0). Example:
|
| trap 'tput clear; exit' EXIT
I use ksh, but the technique is the same, mostly. Since I want to
catch ALL catchable signals, and may want to take action on them in the
logout, my setup looks like this.
for n in 0 1 3 15; do
trap "$HOME/.logout $n" $n
done
The .logout ends with an exit, and I can take special action on
various signals if I wish. Since I may be in on many virtual terminals
and run SysV variants on most machines, I leave with "kill -1 -1" to
kill all processes in the system owned by me. Ugly but effective.
--
bill davidsen - davidsen@sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
sysop *IX BBS and Public Access UNIX
moderator of comp.binaries.ibm.pc and 80386 mailing list
"Stupidity, like virtue, is its own reward" -me
Re: A few questions
Author: Thomas Knott
Date: Thu, 13 Dec 1990 17:24
Date: Thu, 13 Dec 1990 17:24
27 lines
1601 bytes
1601 bytes
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
Re: .logout functionality using ksh <was: A few questions>
Author: Wolf PAUL
Date: Fri, 14 Dec 1990 06:35
Date: Fri, 14 Dec 1990 06:35
26 lines
1552 bytes
1552 bytes
In article <175@raysnec.UUCP> shwake@raysnec.UUCP (Ray Shwake) writes: )fenn@wpi.WPI.EDU (Brian Fennell) writes: ) )>There was a question about .logout for bash... any idea how to fudge )>it with ksh? ) ) The approach I've used successfully involves trapping the logout )signal (signal 0). Example: ) ) trap 'tput clear; exit' EXIT ) ) I use this under SCO and ISC UNIX, among others. On some systems, )the EXIT reference is not recognized, so use 0 instead. Or to simulate .logout completely, do something like trap ". $HOME/.logout ; exit" EXIT which will execute the contents of .logout on exit from the shell. This will also work with the System V.2 Bourne shell, since it too has the trap command. -- W.N.Paul, Int. Institute f. Applied Systems Analysis, A-2361 Laxenburg--Austria PHONE: +43-2236-71521-465 INTERNET: wnp%iiasa@relay.eu.net FAX: +43-2236-71313 UUCP: uunet!iiasa!wnp HOME: +43-2236-618514 BITNET: tuvie!iiasa!wnp@awiuni01.BITNET
Re: A few questions
Author: Jonathan I. Kamens
Date: Sun, 16 Dec 1990 22:32
Date: Sun, 16 Dec 1990 22:32
28 lines
1961 bytes
1961 bytes
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
Re: .logout functionality using ksh <was: A few questions>
Author: Alastair Rae
Date: Fri, 21 Dec 1990 15:38
Date: Fri, 21 Dec 1990 15:38
20 lines
940 bytes
940 bytes
I get .logout in ksh by the following -- .profile: ENV=$HOME/.login .login: alias exit='[ -f ~/.logout ] && . ~/.logout; exit' ENV=$HOME/.kshrc set -o ignoreeof OK, so I have to type 'exit' to log off but I can still use ^D in sub shells. -- .--------------.--------------------.----------------.--------------------. | Alastair Rae | uunet!ukc!mcdd1!ar | +44 442 272071 | *Usual disclaimer* | `--------------^--------------------^----------------^--------------------'
Re: .logout functionality using ksh <was: A few questions>
Author: michael.s.balenger
Date: Fri, 21 Dec 1990 21:09
Date: Fri, 21 Dec 1990 21:09
29 lines
1558 bytes
1558 bytes
>>>>> On 21 Dec 90 15:38:49 GMT, ar@mcdd1 (Alastair Rae) said: ar> I get .logout in ksh by the following -- ar> alias exit='[ -f ~/.logout ] && . ~/.logout; exit' ar> ENV=$HOME/.kshrc ar> set -o ignoreeof ar> OK, so I have to type 'exit' to log off but I can still use ^D in ar> sub shells. I use the following. It works for ^D or "exit". #================================================================ # logout stuff #________________________________________________________________ if tty -s then trap ". $HOME/.logout; exit" EXIT else trap ". $HOME/.logout >/dev/null 2>&1; exit" EXIT fi ---------------------------------------------------------------------- <cute quote> Michael S. Balenger (908) 949-8789 <cute disclaimer> AT&T Bell Labs M_Balenger@att.com Room 1L-405 msb@hos1cad.att.com Crawfords Corner Road att!hos1cad!msb Holmdel, NJ 07733-1988
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads