home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!jvnc.net!rutgers!sgigate!odin!fido!agomoda!williams
- From: williams@agomoda.asd.sgi.com (Eric Williams)
- Newsgroups: comp.sys.sgi
- Subject: Re: batch, at and rc=1
- Message-ID: <p3urmlc@fido.asd.sgi.com>
- Date: 27 Aug 92 19:43:41 GMT
- References: <32240@adm.brl.mil>
- Sender: news@fido.asd.sgi.com (Usenet News Admin)
- Organization: Silicon Graphics, Inc. Mountain View, CA
- Lines: 50
-
- In <32240@adm.brl.mil> beyer@bflsgu.fl.bs.dlr.de (R. Beyer) writes:
- >
- >However, further studies on an Indigo running IRIX 4.0.1 have shown
- >the following curiosity: If identical scripts exist to be submitted
- >to 'at' or 'batch' whereby one script is named 'test' and the other
- >is named 'test.xyz' the latter is executed as expected while the script
- >named 'test' is not executed and gets a tag "rc=1" in the cron logfile.
- >I include a session log. Does anybody have an explanation for this
- >behaviour ?
-
- The name 'test' has special significance to the Bourne shell (/bin/sh).
- From the sh(1) man page:
-
- test
- Evaluate conditional expressions. See test(1) for usage and
- description.
-
- You can see for yourself that it would fail if you try the following:
-
- % /bin/csh
- % cat > test
- #!/bin/csh -f
- echo "Hello, World"
- ^D
- % chmod +x test
- % test
- Hello, World
- % /bin/sh -c test
- % echo $status
- 1
- %
-
- The csh status variable is set to the return code of the /bin/sh execution.
- From the sh(1) man page:
-
- EXIT STATUS
- Errors detected by the shell, such as syntax errors, cause the shell to
- return a non-zero exit status. If the shell is being used non-
- interactively execution of the shell file is abandoned. Otherwise, the
- shell returns the exit status of the last command executed (see also the
- exit command above).
-
-
- One workaround is to use a different name, as you discovered. Another workaround
- is to use a path name for the script. This is probably better anyway, since the
- current method assumes that you have '.' in your path, which not everyone does.
- If you do '/bin/sh -c ./test' or '/bin/sh -c /full/path/to/command/test' it works.
-
- Cheers,
- Eric Williams
-