Command line wizardry, half two: Variables and loops in Bash

Getting the hang of iteratively building commands interactively is all it really takes to become a command line wizard.

Enlarge / Getting the grasp of iteratively constructing instructions interactively is all it actually takes to grow to be a command line wizard. (credit score: Bashar Shglila / Getty Photos)

In our first tutorial on command line wizardry, we lined easy redirection and the fundamentals of sed, awk, and grep. In the present day, we’ll introduce the ideas of straightforward variable substitution and loops—once more, with a particular concentrate on the Bash command line itself, moderately than Bash scripting.

If you should write a script for repeated use—significantly one with important logical branching and analysis—I strongly suggest a “actual language” as an alternative of Bash. Fortunately, there are many choices. I am personally a giant fan of Perl, partially as a result of it is obtainable on just about any *nix system you may ever encounter. Others would possibly moderately select, say, Python or Go as an alternative, and I would not decide.

The actual level is that we’re specializing in the command line itself. Every part under is one thing you’ll be able to simply be taught to assume in and use in actual time with a bit of observe.

Learn 47 remaining paragraphs | Feedback

Related Posts

Leave a Reply

Your email address will not be published.