Sv.2 suid bits and shell scripts
Alexis Dimitriadis
alexis at reed.UUCP
Fri Nov 29 19:29:45 AEST 1985
re `interpreter' is most often "/bin/sh" or "/bin/csh". The _kernel_
regognizes this, and starts the specified interpreter, setting its
effective uid if the script is setuid. Use at your own risk.
Bonus for 4.2 types:
A single argument may follow the `interpreter' name, if it is
separated by exactly one space (aaargh..). This makes it possible to
write an awk or sed script, say `foo', and run it by typing `foo',
without the overhead of exec'ing a shell, like this:
#! /bin/awk -f
(awk commands here)
The kernel tacks the filename at the end, so awk sees
/bin/awk -f /u/ss/alexis/bin/foo
and everything is peachy. This is a really handy trick that I have not
seen used before, so I thought I'd throw it in.
Alexis Dimitriadis
--
_______________________________________________
Any opinions expressed above have been grown organically and contain
no preservatives or artificial sweeteners.
alexis @ reed
{decvax,ihnp4,ucbcad,uw-beaver}!tektronix!reed.UUCP
More information about the Comp.unix.wizards
mailing list