script to check $PATH directories exist
Is there a script that i can use to check if the directories in $PATH exist?
|
try this
Code:
#!/bin/sh |
This 'one liner' can do that for you:
for THIS_PATH in `echo $PATH | sed 's/:/ /g'`; do [[ ! -d $THIS_PATH ]] && echo "WARNING $THIS_PATH does not exist."; done The scripted form would look like this: Code:
#!/bin/bash |
This one-liner would suffice for me:
ls -d `echo $PATH|tr : ' '` Notice how you can also check $? to see if they all exist (ls returns 0 if all went well, 1 if there's an error). Regards Simon |
All times are GMT -5. The time now is 10:10 AM. |