Find all the missing paths in the PATH variable in bash script
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 |
Related Articles:
- 2011/01/14 bash 4.0 – new feature mapfile
- 2011/01/11 perl is faster than bash in some cases.
- 2011/01/05 Shell Scripting
- 2010/12/23 Bash Script Beautifier
- 2010/11/23 intercept stdout/stderr of another process or disowned process

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