2021-07-28

Bash Scripting

lately, nearly every script i write turns out to be Compleat Example of nearly every Bash / POSIX shell feature.  arguments.  loops.  functions.

it has to have some debug statements while i'm writing it.

and some mechanism to not actually DO the <end / final command> while testing*.

wait - these all should be flags in a getopts setup. add a help page.

usual Bash features used in the average script:

    read a file, line at a time
    step thru command line arguments (after getopts is done with "flags")
    rearrange "columns" of input files
    run all sorts of UNIX commands from the script
    how is it, again?  how do you test for string existence? equivalence?
    how do you test for numerical equivalence? greater than or equal?
    sed | grep | cut | awk ... wouldn't this be simpler in Perl?

all that just to do ... now - what was it i was trying to do?

* "I don't always test my code but when I do, I do it in production."

I don't always test my code but when I do, I do it in production - I don't always test my code but when I do, I do it in production  The Most Interesting Man In The World


No comments: