Ask a Question related to Sun Solaris, Design and Development.
-
Michael Wang #1
Where does "Terminated" message comes from?
(1)
Here is the test program:
--
$ cat trap6.ksh
#!/bin/ksh
trap 'print a; print b' exit
sleep 10
exit 3
--
when killed, it produces message:
a
b
Terminated
on screen. "Terminated" output is neither stdout nor stderr, where
does it come from, and how to capture it?
(2)
However, if run by another shell:
--
$ cat 1.ksh
exec 1>1.1a 2>1.1b
../trap6.ksh
--
The "Terminated" output is changed slightly, and it is in run_trap6
stderr:
1.ksh[2]: 16817 Terminated
Why?
--
Michael Wang * [url]http://www.unixlabplus.com/[/url] * [email]mwang@unixlabplus.com[/email]
Michael Wang Guest
-
MySQL Connector .NET 1.0.6 and "Connection unexpectedly terminated" exception
Dear newsgroup, I'm having a critical problem with the MySQL Connector .NET 1.0.6. I'm developing a .NET (Version 1.1 SP1) application on a... -
#25620 [WFx]: Crash / "String is not zero-terminated"
ID: 25620 User updated by: xris at farcaster dot net Reported By: xris at farcaster dot net Status: Wont fix Bug... -
#25620 [Opn->WFx]: Crash / "String is not zero-terminated"
ID: 25620 Updated by: sniper@php.net Reported By: xris at farcaster dot net -Status: Open +Status: ... -
#25620 [Fbk]: Crash / "String is not zero-terminated"
ID: 25620 Updated by: sniper@php.net Reported By: xris at farcaster dot net Status: Feedback Bug Type: ... -
#25620 [NEW]: Crash / "String is not zero-terminated"
From: xris at farcaster dot net Operating system: GNU/Linux 2.4.20 PHP version: 4.3.3 PHP Bug Type: Reproducible crash Bug... -
Michael Wang #2
Where does "Terminated" message comes from?
(1)
Here is the test program:
--
$ cat trap6.ksh
#!/bin/ksh
trap 'print a; print b' exit
sleep 10
exit 3
--
when killed, it produces message:
a
b
Terminated
on screen. "Terminated" output is neither stdout nor stderr, where
does it come from, and how to capture it?
(2)
However, if run by another shell:
--
$ cat 1.ksh
exec 1>1.1a 2>1.1b
../trap6.ksh
--
The "Terminated" output is changed slightly, and it is in run_trap6
stderr:
1.ksh[2]: 16817 Terminated
Why?
--
Michael Wang * [url]http://www.unixlabplus.com/[/url] * [email]mwang@unixlabplus.com[/email]
Michael Wang Guest
-
Darren Dunham #3
Re: Where does "Terminated" message comes from?
Michael Wang <mwang@unixlabplus.com> wrote:
> (1)> Here is the test program:> --
> $ cat trap6.ksh
> #!/bin/ksh
> trap 'print a; print b' exit
> sleep 10> exit 3
> --> when killed, it produces message:> a
> b
> Terminated"It" (meaning the script) does not produce that message. Instead, your> on screen. "Terminated" output is neither stdout nor stderr, where
> does it come from, and how to capture it?
shell which launched the script produced the message. You can see the
same thing with a script that only does a 'sleep 10'.
> (2)> However, if run by another shell:> --
> $ cat 1.ksh
> exec 1>1.1a 2>1.1b
> ./trap6.ksh
> --> The "Terminated" output is changed slightly, and it is in run_trap6
> stderr:> 1.ksh[2]: 16817 TerminatedBecause this time you didn't run trap6 from your interactive shell.> Why?
This time your subshell (which is 1.ksh) ran the script. The parent
script is responsible for the message, and it sends it on stderr.
--
Darren Dunham [email]ddunham@taos.com[/email]
Unix System Administrator Taos - The SysAdmin Company
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >
Darren Dunham Guest
-
John DuBois #4
Re: Where does "Terminated" message comes from?
In article <dcUUa.14$Uc3.36694@news.uswest.net>,
Michael Wang <mwang@unixlabplus.com> wrote:It comes from the shell you ran your test program from. The shell notices that>(1)
>
>Here is the test program:
>
>--
>$ cat trap6.ksh
>#!/bin/ksh
>trap 'print a; print b' exit
>sleep 10
>
>exit 3
>--
>
>when killed, it produces message:
>
>a
>b
>Terminated
>
>on screen. "Terminated" output is neither stdout nor stderr, where
>does it come from, and how to capture it?
the test program was killed by SIGTERM, so it prints "Terminated". If you want
to know whether this occured, you can check the exit status as recorded in $?.
If you want to avoid the "Terminated" message, run it in a subshell:
( testprog ) 2>/dev/null
John
--
John DuBois [email]spcecdt@armory.com[/email] KC6QKZ/AE [url]http://www.armory.com/~spcecdt/[/url]
John DuBois Guest



Reply With Quote

