1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#!/bin/sh [ -d bin.sys ] || mkdir bin.sys cd bin.sys while [ $# -gt 0 ] do while read d do if [ -x $d/$1 ] then rm -f ./$1 ln -s $d/$1 . break fi done <<-HERE /bin /usr/bin /usr/sbin /usr/libexec /usr/local/bin `find /usr/lib/postgresql -name bin -type d` HERE shift done