Under Linux, there are some powerful tools that for all practical purposes are unavailable under Windows (I can imagine all the old Linux hands saying “Duh!”).
One of these tools is something called “shell programming”. This means writing code that a command shell executes.
There is something like this under Windows, but as usual, the Windows version is a weak imitation.
The most common Linux shell is named “Bash”. The name comes from “Bourne Again SHell,” which, in turn … (imagine a lengthy recursion terminating in a caveman’s grunt).
There are many other shells available. Unless there is a compelling reason not to, I recommend that people stick to the Bash shell, because this increases the chance that your scripts will be portable between machines, distributions, even operating systems.
I’ll be showing some very basic examples of Bash shell programming on this page, and I want to say at the outset that shell programming is an art, not a science. That means there is always some other way to do the same thing.
Because shell programming is an art, please don’t write to say, “Wow, that was a really inefficient way to do such-and-such.”
If this page seems too sketchy and elementary for your taste, you can choose from among the more advanced resources in this list.
An Introduction to Bash Shell Programming in Linux 规格严格
打印