Just wrote a script in bash shell that need to check if directory exists, else create the directory. I always need to write script that check the if a directory exists but i always forget :p. So i think it’s better for me to put this down for my later reference 🙂
To check if directory exists in bash shell script, check the command below:-
Advertisements
- The bash script below will check if directory exists:-
if [ -d /home/techie/backup/2010 ] then # do something here if exists fi - The bash script below will check if directory is NOT exists:-
if [ ! -d /home/techie/backup/2010 ] then # if not exists do something here fi
Related posts:
How to move cursor to end of line in vi editor
Free Anti Virus for Mac OS X - ClamXav
How to install SVN 1.6 on CentOS 5
N900: How to connect Wifi protected setup compliant Network
How to find your MAC address in Mac and Window
How to batch resize image in Mac OS X
Word cannot start the spelling checker - Word 2011
How to disable notification center in Mac OS X
Share this with your friends:-