Quantcast
Channel: Shell script to test whether a directory exists and if not create it? - Stack Overflow
Browsing all 3 articles
Browse latest 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 all 3 articles
Browse latest View live


Latest Images