This is so handy, I can’t believe i’ve never used or even heard of this until today! You can easily run your bash shell scripts in debug mode to watch what they’re doing behind the scenes in real time. You get to see the levels of nesting when you’re inside loops and variables get replaced with their actual contents at the time of execution.
This might come in handy if you have multiple levels of nesting in ‘for’ and ‘while’ loops or a few if/then/else statements and you want to see just what is getting passed in the comparisons.
I just thought I found a really bad flaw in an O’Reilly book that I starting thumbing through entitled “BSD Hacks - 100 Industrial Strength Tips & Tools” written by Dru Lavigne. In one of the very hacks the author enlists the reader to create his or her very first script. “If you’ve never written a script before, this is an excellent exercise in how easy and useful scripting can be.” I laughed after reading this because it’s also an exercise in how much damage such a small bug can do.
shc is the only tool i’ve found that will compile scripts so idle hands won’t tamper with your bash shell scripts. Yes, I know I could just use permissions to keep people from reading them and it’s easy to reverse engineer the binary code, but I look at it like …
In a shell script you’re probably testing a variable against some constant or another variable, but why not run a command in a subshell and compare the output? You could even compare the output of two subshell commands! I guess most of the time i’m doing something like this i’m …