So, when you write a bash script that does a certain amount of tasks for you, but you don’t want the script to keep running after some command inside the script failed, simply add a line to the script.
Tag Archives: bash
Remember those countless times you’ve edited a file with nano, didn’t notice that you weren’t root at the time, and carefully made your configuration changes and saved the file, only to find out that you weren’t root and you have no rights to modify the file?
I use this a lot, and you should too. It saves lots of time, but you should also be aware that password-less authentication (and it’s ease) imposes a security risk on your behalf. You should be very cautious when you’re connecting to the remote machines (whether they are testing, staging or production environments, in ascending [...]
I found out a useful thing today. You can redirect output of bash control structures as well. Typically useful for for loops, which would need a buffer of some kind otherwise to have it’s output sorted, for example.
I’ve found bash scripting to be one of the gems I (re)discovered this year. When you’re like me, you like to automate stuff. There’s of course loads of scripting languages available to get it done, but frankly, using bash for lots of filesystem and/or configuration related tasks makes more sense than for example PHP or [...]