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 enable email notification in Adium?
How to enable personal file sharing in Ubuntu 10.04
WordPress: How to create left sidebar template in TwentyEleven theme?
How to enhance and increase battery life for N900
How to delete all .svn folder in Linux / Mac?
Rip DVD Movies with Handbrake
How to add native menu support in your WordPress theme?
How to install apache, php, mysql with macport in Mac OS X
Share this with your friends:-