Where does "Terminated" message comes from?

Ask a Question related to Sun Solaris, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. #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...
    3. #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: ...
    4. #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: ...
    5. #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...
  3. #2

    Default 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

  4. #3

    Default 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
    > on screen. "Terminated" output is neither stdout nor stderr, where
    > does it come from, and how to capture it?
    "It" (meaning the script) does not produce that message. Instead, your
    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 Terminated
    > Why?
    Because this time you didn't run trap6 from your interactive shell.
    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

  5. #4

    Default Re: Where does "Terminated" message comes from?

    In article <dcUUa.14$Uc3.36694@news.uswest.net>,
    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
    >
    >on screen. "Terminated" output is neither stdout nor stderr, where
    >does it come from, and how to capture it?
    It comes from the shell you ran your test program from. The shell notices that
    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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139