Solaris8 Sparc, sh or ksh:
I'm using the following in my .profile to get around the 900s
connection timeout on the corp. firewall (ssh/telnet):
(while true;do sleep 600;echo "";done)&
And while it works well, I have to type exit twice or kill the bg job
before exiting, which is really annoying:
[sgpws01]/root # exit
You have running jobs
[sgpws01]/root # exit
Connection to sgpws01 closed.
I've tried a variety of traps and aliases to kill the job before
exiting, but nothing seems to work:
[sgpws01]/root # alias e='kill %1;exit'
[sgpws01]/root # e
You have running jobs
[sgpws01]/root # e
<.profile>
trap 'kill %1; exit' 0
Any idea how I can have my cake and eat it too?
TIA, krp
|
|
0
|
|
|
|
Reply
|
kpacek
|
4/2/2004 11:19:21 PM |
|
G'Day,
Looks like you were on the right track. In ksh try,
alias exit="kill %1;wait $!;exit"
(double quotes are needed for $!, and aliases are parsed before builtins
so "exit" will work).
.... You've said this was both sh and ksh - if it were just ksh I'd check
if the TMOUT variable was set to cause the timeout.
Brendan Gregg
[Sydney, Australia]
On 2 Apr 2004, Kevin R. Pacek wrote:
> Solaris8 Sparc, sh or ksh:
>
> I'm using the following in my .profile to get around the 900s
> connection timeout on the corp. firewall (ssh/telnet):
>
> (while true;do sleep 600;echo "";done)&
>
> And while it works well, I have to type exit twice or kill the bg job
> before exiting, which is really annoying:
>
> [sgpws01]/root # exit
> You have running jobs
> [sgpws01]/root # exit
> Connection to sgpws01 closed.
>
> I've tried a variety of traps and aliases to kill the job before
> exiting, but nothing seems to work:
>
> [sgpws01]/root # alias e='kill %1;exit'
> [sgpws01]/root # e
> You have running jobs
> [sgpws01]/root # e
>
> <.profile>
> trap 'kill %1; exit' 0
>
> Any idea how I can have my cake and eat it too?
>
> TIA, krp
>
|
|
0
|
|
|
|
Reply
|
Brendan
|
4/3/2004 3:57:48 AM
|
|