ESCREVENDO SCRIPTS SHELL
Here is where the fun begins
With the thousands of commands available for the command line user, how can you remember them all? The answer is, you don't. The real power of the computer is its ability to do the work for you. To get it to do that, we use the power of the shell to automate things. We write scripts.
Scripts are collections of commands that are stored in a file. The shell can read this file and act on the commands as if they were typed at the keyboard. In addition to the things you have learned so far, the shell also provides a variety of useful programming features to make your scripts truly powerful.
What are scripts good for? A wide range of tasks can be automated. Here are some of the things I automate with scripts:
- A script gathers up all the files (over 2200) in this site on my computer and transmits them to my web server.
- The SuperMan pages are built entirely by a script.
- Every Friday night, all my computers copy their files to a "backup server" on my network. This is performed by a script.
- A script automatically gets the current updates from my Linux vendor and maintains a repository of vital updates. It sends me an email message with a report of tasks that need to be done.
As you can see, scripts unlock the power of your Linux machine. So let's have some fun!
Contents
- Writing your first script and getting it to work
- Editing the scripts you already have
- Here Scripts
- Substitutions - Part 1
- Substitutions - Part 2
- Quoting
- Shell Functions
- Some Real Work
- Flow Control - Part 1
- Stay Out of Trouble
- Keyboard Input and Arithmetic
- Flow Control - Part 2
- Positional Parameters
- Flow Control - Part 3
- Errors and Signals and Traps (Oh My!) - Part 1
- Errors and Signals and Traps (Oh My!) - Part 2
Nenhum comentário:
Postar um comentário