On Sun, 2013-01-06 at 12:35 +0100, Tobias Gasser wrote: > > AWK=`readlink -f /usr/bin/awk` > > awk=/usr/bin/awk > > [ "$AWK" == "/usr/bin/gawk" ] || die "$awk is not a symlink to gawk" > > some distros started to drop the /usr hierarchy > > the script should be a little smarter to accept the files not only in > /usr/bin but just anywhere in $PATH > > something like > > awk=$( which awk ) > AWK=$( readlink -f "${awk}" ) > [ "${AWK%%\/gawk}" == "${AWK}" ] && die...
Thinking about it, that's still unnecessarily complicated. Because for all the talk about symlinks, what we actually care about is that running 'awk' results in running 'gawk'. And to test that, we don't need to mess with readlink and stuff - we just need to run it and ask it what it is... $ awk --version | head -n 1 GNU Awk 4.0.1 Likewise the bash/dash thing, for that matter - we don't care about symlinks, we care that 'sh' is the same thing as bash. $ sh --version | head -n 1 GNU bash, version 4.2.39(1)-release (x86_64-unknown-linux-gnu) No need to worry about /bin vs /usr/bin, or whether files might be symlinked, hardlinked, or outright copies. Simon.
signature.asc
Description: This is a digitally signed message part
-- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page