NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Behaviour in shell script with job control enabled
Hi all.
I was writing a shell script with `while ping6 ...` but I faced problems
that show up only in interactive shells. After investigating, I figured
out it was due to the -m option (job control -- set on by default when
running shell interactively). So I wrote the following:
#!/bin/sh
set +m
if ping6 -c 1 fe80::a800:ff:fe13:942f >/dev/null; then
echo yes
else
echo no
fi
set -m
if ping6 -c 1 fe80::a800:ff:fe13:942f >/dev/null; then
echo yes
else
echo no
fi
In zsh, sh, and ksh output is:
no
<blank line here>
In bash, output is:
no
no
Using NetBSD 7.0.
Why enabling (or not) job control (-m) should change the script
behaviour?
Thanks.
--
Silas
Home |
Main Index |
Thread Index |
Old Index