- Save the following shell script as mkpath.pl :
#!/bin/sh
find / -type d 2>/dev/null | grep -vi packages | grep -vi patches | grep -v "/tmp/" | sort | uniq | awk -F/ '
BEGIN {
path = "";
ldpath = "";
libpath = "";
manpath = "";
}
{
if (( $NF == "bin" ) || ( $NF == "sbin" )) {
path = path ":" $0;
} else if ( $NF == "lib" ) {
ldpath = ldpath ":" $0;
libpath = libpath ":" $0;
} else if ( $NF == "man" ) {
manpath = manpath ":" $0;
}
}
END {
print "export PATH=$PATH"path;
print "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH"ldpath;
print "export LIBPATH=$LIBPATH"libpath;
print "export MANPATH=$MANPATH"manpath;
}'
- Don't forget to chmod it to -rwxr-xr-x
- Redirect it to your .bashrc like this : ./mkpath.pl >> ~/.bashrc
- Edit it to fit your needs.
- Logout, then Logon again and enjoy.
NB: Don't use it on a
Solaris machine as this would generate a really
long damn'
PATH which would be too long to clean up that you'd have lost more time that saved with this
script.