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

2011-01-20 1 min read bash Fedora Learning

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
comments powered by Disqus