Timeline for Return on error in shellscript instead of exit on error
Current License: CC BY-SA 3.0
16 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 11, 2016 at 13:18 | history | edited | Jeff Schaller♦ | CC BY-SA 3.0 | English contractions use apostrophes. |
| Jul 29, 2016 at 13:00 | history | edited | Alex | CC BY-SA 3.0 | double-quoted all variables |
| Jul 29, 2016 at 12:59 | comment | added | Alex | No, that's perfectly fine that you are picky here, thanks for the feedback! Saves my script from failing in some cases which I just did not consider so far ! | |
| Jul 29, 2016 at 12:55 | comment | added | Kusalananda♦ | ${dest} and ${source} are still unquoted, and they contain user input. I'm being a bit picky with you here, but you need to quote them in your script on your machine, or simple things like copying files with spaces in their names won't work. Sorry. I'm just trying to give constructive feedback. | |
| Jul 29, 2016 at 12:45 | history | edited | Alex | CC BY-SA 3.0 | double-quoted user-imput |
| Jul 29, 2016 at 12:44 | vote | accept | Alex | ||
| Jul 29, 2016 at 12:29 | comment | added | Kusalananda♦ | Double quote your user input. Don't use () when calling shell functions. | |
| Jul 29, 2016 at 12:19 | history | edited | Alex | CC BY-SA 3.0 | updated example in order to better explain problem, fixed some minor things |
| Jul 29, 2016 at 11:52 | vote | accept | Alex | ||
| Jul 29, 2016 at 12:44 | |||||
| Jul 29, 2016 at 11:44 | history | edited | Alex | CC BY-SA 3.0 | just fixed a typo in the code |
| Jul 29, 2016 at 10:37 | answer | added | ctrl-alt-delor | timeline score: 5 | |
| Jul 29, 2016 at 10:31 | comment | added | ctrl-alt-delor | If you source that it will ignore the #! and will apply set -e to the calling shell, so will apply to all subsequent commands. | |
| Jul 29, 2016 at 9:59 | comment | added | Kusalananda♦ | @ddnomad The set -e sets the errexit option in the shell. When calling the function, the cp fails and the shell exits for me. | |
| Jul 29, 2016 at 9:52 | answer | added | Kusalananda♦ | timeline score: 6 | |
| Jul 29, 2016 at 9:34 | comment | added | ddnomad | Are you sure it would close down the console? I tried to run the script as you described and it terminates the whole things throwing cp error and exiting with 1 exit code. | |
| Jul 29, 2016 at 9:21 | history | asked | Alex | CC BY-SA 3.0 |