For a csh script, the first line is typically "#!/bin/csh -f". The "-f" option
tells the shell not to read the user's .cshrc file on startup, which improves
both speed and portability.
It's a common mistake to do the same thing for Bourne shell scripts by using
"#!/bin/sh -f". However, the Bourne shell's "-f" option is completely
different from csh's "-f" option. It disables file name generation. For
example, the following script:
#!/bin/sh
echo foo*
OUTPUT:
foo foo1 foo2 foo123
will print the names of all the files in the current directory whose names
begin with "foo" (or a literal "foo*" if there are no such files), but the
following script:
#!/bin/sh -f
echo foo*
OUTPUT:
foo*
will print a literal "foo*" unconditionally.
There are a number of Globus scripts that use "#!/bin/sh -f". It's possible
that this was deliberate, but unlikely. A quick look at the scripts indicates
that none of them use file wildcards anyway, so the "-f" probably has no
effect.
Suggestion: Replace "#!/bin/sh -f" with just "#!/bin/sh", just to avoid
confusion.
No comments:
Post a Comment