NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
/bin/sh incorrect return status for background jobs
Hello, I don't seem to be able to get correct return status for
background jobs with NetBSD /bin/sh
From the man page:
wait [job]
Wait for the specified job to complete and return the exit status of
the last process in the job. If the argument is omitted, wait for all
jobs to complete and then return an exit status of zero.
However if I run the following script
#!/bin/sh
func()
{
sleep 2
touch /no_such_file
}
func &
wait $!
echo $?
I always get 0 as return status with NetBSD sh:
$ ./test.sh
touch: /no_such_file: Permission denied
0
Same script executed with bash:
atom510$ ./test.sh
touch: /no_such_file: Permission denied
1
Looks like a bug to me?
Home |
Main Index |
Thread Index |
Old Index