If directory doesn't exist, try the next one? - Which command to use?
I have a little script where it goes to a certain directory, but if that directory doesn't exist, I want to try to go to a different directory. What linux commands should I be using?
For example: #Go to this directory cd $HOME/Desktop/"${projName}"/HTML if = FAILS { go to this directory} Thanks |
In case of failure, is it always the same other directory you want
to go to, or just the next one in a list? |
You can do something like -d: http://stackoverflow.com/questions/5...h-shell-script
Example Code:
if [ -d "$DIR" ]; then |
Quote:
That worked perfectly, thanks! |
All times are GMT -5. The time now is 02:41 PM. |