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 empty Trash in Roundcube web mail - CPanel?
How to clear play history in VLC media player
On Screen Keyboard in Mac OS X
Bootstrap 3: Responsive image align center
How to change trackpad reverse scrolling in Mac OS X Lion
N900 virtual keyboard not working after uninstall SCIM
Turn on MySQL query cache to speed up query performance?
How to merge pdf file in Mac OS X using Preview
Share this with your friends:-