Quantcast
Channel: Shell script to test whether a directory exists and if not create it? - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by Jim Lewis for Shell script to test whether a directory exists and...

mkdir -p $directory should do what you want. The -p option will create any necessary parent directories. If $directory already exists as a directory, the command does nothing, and succeeds. If...

View Article


Answer by Ignacio Vazquez-Abrams for Shell script to test whether a directory...

test ... || mkdir ...

View Article


Shell script to test whether a directory exists and if not create it?

I am trying to create a script to detect whether a directory exists, and if it does not, to create it.How can I do that?I did some digging and found a clue:test -d directory...will return true or false...

View Article
Browsing latest articles
Browse All 3 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>