Re:OS X DNS cache reset script
by coherentpony on Tuesday June 14, 2016 @11:51AM
(#11902814)
It's good practice to include
to avoid the default ON ERROR RESUME NEXT behaviour of bash.
[ Parent
| on HN ]
Is that behaviour not the point here? The script tries the first command,then the second if that fails,etc.
One should also create traps on exit, to revert the system to a good state in the event of pipefail.
Please stop with the cargo-cult shell scripting. That's not all those options do.
Re:OS X DNS cache reset script
by Someone1234 on Tuesday June 14, 2016 @12:19PM
(#11903071)
Perhaps an explanation would have been more constructive than an insult.
Yes, I owe an explanation, but the guy advocating pasting bash settings into every script doesn't.
He gave an explanation of what they do. It might be wrong, but you haven't given any alternative one.
Besides he is right, and those are useful additions to almost any script that you want to stop on error, undefined vars, etc.