Pierre Labastie wrote: > Le 13/03/2012 20:14, Bruce Dubbs a ecrit: >> - if [ "$2" == "lib" ]; then >> - file=$(PATH=/lib:/usr/lib type -p $1) >> + if [ "$2" = "lib" ]; then >> + file=$(find /lib /usr/lib -maxdepth 1 -name $1 | head -n 1) >> else >> - file=$(type -p $1) >> + file=$(find /bin /usr/bin /sbin /usr/sbin -maxdepth 1 -name $1 | >> head -n 1) >> fi >> >> Also the `type` command is a >> bash builtin. The changes do the same thing as the current code but >> with a different style. I don't think changes are needed.
> type -p $1 returns nothing if $1 is an alias. This happened to > me because I have > alias ls='ls --color=auto' in /etc/bashrc. Then of course, > `copy ls bin' does not do what it is supposed to do. There are certainly > better ways to correct that, but it should be corrected. For a non-interactive shell, bash does not read rc files (they would have to be explicitly sourced). Alias entries are not propagated to subshells. The commands specified work properly from a script, but not, if an alias exists, when executed from an interactive shell (e.g. paste). -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
