[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: awk progfile



>BTW: Can somebody give me a clue why awk is /usr/bin/awk in Debian (also
>e.g., ksh) (and /bin/awk in most other systems I've seen)?
>What's the standard "#! " way to get a script running on both? ln -s
>/usr/bin/<prg> /bin/<prg> in Debian (and vice versa in other systems)?
>(please cc me)

Debian tries to follow a system where the only programs in bin are those of
utmost importance; this is because some systems mount /usr
remotely but /bin locally, and these systems want to minimize the
space taken up by /bin

To do the script thing:  There is no one-line solution that I know of.
You can do it with a shell script:

-- cut
#!/bin/bash

SCRIPT=/your/real/awk/script/goes.here

#try 'which'
AWK=`which awk`;
test -x $AWK && exec $AWK $SCRIPT

#now try standard places (in case which failed)
for AWK in {/bin/,/usr/bin/}{mawk,awk,gawk,nawk}; #any others?
do
  test -x $AWK && exec $AWK $SCRIPT ;
done

--end of script


Reply to: