Reputation: 11
I need a bash script which will find a folder named "Test" in a directory. If it's present there it willn't make the folder named "Test" otherwise it will make a folder named "Test" in the directory. Tried ifs, if, for loop but in vain.
Upvotes: 0
Views: 46
Reputation: 26
Here's the code you're probably looking for (pretty basic):
folder="Test"
dir="d"
if [[ !(-e $dir/$folder) ]];then
mkdir $dir/$folder
fi
-e operator, checks if thats anything as name="Test".
Upvotes: 1