Unix Shell - bash set -m

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > May 2007 > bash set -m





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author bash set -m
tmp123

2007-05-18, 7:20 am

Hello,

This small script:

foo.sh
------
#!/bin/bash
#
set -m
sleep 60

when executed in a interactive shell, typing:

../foo.sh &

finishes the interactive shell (that is, ends its parent).

However, the following works like expected:

../foo.sh
or
../foo.sh > /dev/null 2>&1 &

I'm wondering if this is the expected way of work. Test are done using
bash and Solaris.

Thanks a lot.

Skye Shaw!@#$

2007-05-20, 7:21 pm

On May 18, 5:16 am, tmp123 <tmp...@menta.net> wrote:
> #!/bin/bash
> #
> set -m
> sleep 60
>
> when executed in a interactive shell, typing:
>
> ./foo.sh &
>
> finishes the interactive shell (that is, ends its parent).
>
> However, the following works like expected:
>
> ./foo.sh
> or
> ./foo.sh > /dev/null 2>&1 &
>
> I'm wondering if this is the expected way of work. Test are done using
> bash and Solaris.


Strange... set -m causing the background foo.sh process to report
sleep's status, which in turn raises TTOU. When you redirect, there
is no IO on the term and it works fine.

set -m
sleep 60&

works. Hum.....................
On May 18, 5:16 am, tmp123 <tmp...@menta.net> wrote:
> #!/bin/bash
> #
> set -m
> sleep 60
>
> when executed in a interactive shell, typing:
>
> ./foo.sh &
>
> finishes the interactive shell (that is, ends its parent).
>
> However, the following works like expected:
>
> ./foo.sh
> or
> ./foo.sh > /dev/null 2>&1 &
>
> I'm wondering if this is the expected way of work. Test are done using
> bash and Solaris.


Strange... seems maybe set -m causes the background foo.sh process to
report sleep's status, which in turn raises TTOU. When you redirect,
there is no IO on the term and it works fine.

With set -m on, it seems one cant trap this signal either.

set -m
sleep 60&

Works. Additional thoughts?


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com