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
#!/bin/sh [ -d bin.sys ] || mkdir bin.sys cd bin.sys while read d do if [ -x $d/$1 ] then while [ $# -gt 0 ] do rm -f ./$1 ln -s $d/$1 . shift done exit 0 fi done <<-HERE /bin /usr/bin /usr/local/bin /usr/lib/postgresql/10/bin /usr/lib/postgresql/9/bin HERE