#! gotcha
Dave Sill
dsill at nswc-oas.arpa
Thu Apr 28 07:22:53 AEST 1988
I ran into a good one yesterday. A shell script was, for some reason,
running under a restricted shell depending upon whether the file name
of the script contained an 'r'. This only occurred when the script
was run directly; typing `sh bar' worked fine.
It turns out the Bourne shell looks for an 'r' anywhere in argv[0] and
runs restricted if it finds one. Well, that seems ok. After all, we
don't usually rename the shell.
Unfortunately, when #! magic is used to specify the shell, argv[0]
becomes the name of the shell script.
I don't know how widespread this problem is. On our 4.2 BSD system
the code that looks for 'r's in argv[0] is commented out. It got me
on a 4.1c BSD system.
=========
The opinions expressed above are mine.
%%
"We must remove the TV-induced stupor that lies like a fog across the
land."
-- Ted Nelson
More information about the Comp.unix.wizards
mailing list