Find all the missing paths in the PATH variable in bash script

2011-01-20 154 words 1 min read

Here is a simple script that will list out all the paths in the PATH variable that do not exist.

  <td>
    <div class="text codecolorer">
      #!/bin/bash -<br /> #===============================================================================<br /> #<br /> #          FILE:  wrong_path.sh<br /> #<br /> #         USAGE:  ./wrong_path.sh<br /> #<br /> #   DESCRIPTION:  Show Directories in the PATH Which does NOT Exist<br /> #<br /> #       OPTIONS:  ---<br /> #  REQUIREMENTS:  ---<br /> #          BUGS:  ---<br /> #         NOTES:  ---<br /> #        AUTHOR:  Amit Agarwal (AKA), amit.agarwal@amit-agarwal.co.in<br /> #       COMPANY:  Individual<br /> #       VERSION:  1.0<br /> #       CREATED:  09/20/2009 09:15:48 AM IST<br /> #      REVISION:  ---<br /> #===============================================================================<br /> <br /> set -o nounset                              # Treat unset variables as an error<br /> <br /> (IFS=:;for p in $PATH; do test -d $p || echo $p; done)
    </div>
  </td>
</tr>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

Tags: bash Path wrong

author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it