My quick GPL'd script to adjust some PATH environment variables

created by mirko
(idea) by mirko (2.4 d) (print)   (I like it!) Wed Jan 24 2001 at 11:07:04
  1. 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;
                    }'
    
  2. Don't forget to chmod it to -rwxr-xr-x
  3. Redirect it to your .bashrc like this : ./mkpath.pl >> ~/.bashrc
  4. Edit it to fit your needs.
  5. 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.
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.