Timeline for Creating remote directories in a bash script via ssh (with error trapping)
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 21, 2019 at 17:58 | comment | added | Oh My Goodness |
mkdir -p does not print "file exists" if the file exists. It does nothing.
|
|
Feb 21, 2019 at 14:24 | comment | added | Server Fault |
This is a great way to shorten it up but how do I get the test -d in there so no output (File exists ) is produced if mkdir -p fails?
|
|
Feb 21, 2019 at 10:29 | comment | added | Oh My Goodness |
@TobySpeight good point and that makes -e unnecessary so it's only 2 extra characters.
|
|
Feb 21, 2019 at 10:26 | comment | added | Toby Speight |
There's a slight difference IIUC: the original stops at the first error, but mkdir will continue with subsequent arguments before exiting with a failure code.
|
|
Feb 21, 2019 at 9:21 | comment | added | Toby Speight |
Trading some succinctness for a little extra efficiency, we could prefix the command with exec since there's no need to return to the shell.
|
|
Feb 21, 2019 at 7:16 | history | edited | Oh My Goodness | CC BY-SA 4.0 |
added 38 characters in body
|
Feb 21, 2019 at 7:10 | history | answered | Oh My Goodness | CC BY-SA 4.0 |