Verify all the paths in the PATH directory

Here is the command to test that all the directories in your path actually exist.

(IFS=:;for p in $PATH; do test -d $p || echo $p; done)

And the explanation :

Set the IFS to \”:\”

now we loop through the PATH variable

and test all the directories with \”test -d\”

Here is another version without IFS:

for i in ${PATH//:/ };do test  -d $i || echo $i;done

and next one without the test command:

for i in ${PATH//:/ };do [  -d $i ] || echo $i;done


2 thoughts on “Verify all the paths in the PATH directory”

  1. You areawesome! This weblog is really fantastic. I actually wish much more folks understand this and get what youre stating, simply because let me tell you, its critical stuff. I by no means wouldve imagined regarding it by doing this unless Id run into your webpage. Thank you for putting it up. I hope you’ve fantastic achievement.

This site uses Akismet to reduce spam. Learn how your comment data is processed.