pfeiffer@rsch.WISC.EDU (Phil Pfeiffer) (09/16/86)
The systems in question are 4.3BSD Unix and Ultrix.
The problem is as follows:
Assume file "nxf" does not exist.
Assume the following lines are in shell script 'cmd':
#!/bin/csh
rm nxf >& cmd_out
echo $status > cmd_stat
Assume the following lines are in shell script 'master':
#!( doesn't matter whether master is executed using "/bin/sh" or "/bin/csh" )
cmd
'master', as is, executes just fine. The "cannot find file" error message and
error status values are written into cmd_out and cmd_stat, respectively.
Assume the following lines are in shell script 'bgmaster':
#!( doesn't matter whether master is executed using "/bin/sh" or "/bin/csh" )
cmd &
wait
Now "cmd_out" is empty on return, and "cmd_stat=1". Why?
--
-- Phil Pfeiffer
...!{harvard,ihnp4,seismo,topaz}!uwvax!pfeiffer
(608) 263-7308avolio@decuac.UUCP (09/17/86)
A background job executed from a login shell is related to the
invoker's terminal. A shell script similarly. A background job
executed from a shell script is not.
Example:
Put the line
tty > jnk
in cmd.
When you run cmd or master it works fine. From bgmaster it says "not
a tty"
Now, "rm" has a check in it to see if you are a terminal (isatty()).
If not, it runs as if the -f flag was specified.
--
Fred @ DEC Ultrix Applications Center
INET: avolio@decuac.dec.com * Fight the Fight *
UUCP: {decvax,seismo,cbosgd}!decuac!avolio * Rescue the Unborn *