SCO 6 (RE: FW: The grand finale)
Bob Stockler
bob at trebor.iglou.com
Fri Nov 11 08:36:53 PST 2005
Ken Brody wrote (on Fri, Nov 11, 2005 at 10:07:15AM -0500):
| However, if your script doesn't start with "#!/bin/sh" (and, honestly,
| how many of you always put the shell there?), and it depends on some
| Bourne-specific behavior which changes in Korn, you're SOL unless you
| change your script to either work under Korn, or add the "#!/bin/sh".
I, for one, do. For those who don't, this little
shell script will make "#!/bin/sh" the first line
in all of the scripts given to it as arguments on
the command line, editing them in place:
#!/bin/ksh
for FILE in $@
do awk -v FILE="$FILE" '
NR==1 { if ( $0 !~ /#!\/bin\/sh/ ) line[++n] = "#!/bin/sh" }
{ line[++n] = $0 }
END { for (i=1;i<=n;i++) print line[i] >FILE }' $FILE
done
Bob
--
Bob Stockler +-+ bob at trebor.iglou.com +-+ http://members.iglou.com/trebor
Author: MENU EDIT II - The BEST Creator/Editor/Manager for filePro User Menus.
Fully functional (time-limited) demos available by email request (specify OS).
More information about the Filepro-list
mailing list