LinuxCommand
Learning the
shell
Script
library
SuperMan
pages
Who, What,
Where, Why
|
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
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 in this
site (over 2200) 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!
-
Writing your first
script and getting it to work
- Writing a
script
- Setting
permissions
- Putting it in
your path
-
Editing the scripts you
already have
- Commands,
commands, everywhere
- Aliases
- Shell
functions
- type
- .bashrc
-
Here Scripts
- Writing an
HTML file with a script
-
Substitions - Part 1
- Variables
- How to create
a variable
- Where does
the variable's name come from?
- How does this
increase our laziness?
- Environment
Variables
-
Substitions - Part 2
- --help and
other tricks
- Assigning a
command's result to a variable
- Constants
-
Quoting
- Single and
double quotes
- Quoting a
single character
- Other
backslash tricks
-
Shell Functions
- Keep your
scripts working
-
Some Real Work
- show_uptime
- drive_space
- home_space
- system_info
-
Flow Control - Part
1
- if
- What is
a "condition"?
- Exit
status
- test
- exit
- Testing
for root
-
Stay Out of Trouble
- Empty
variables
- Missing
quotes
- Isolating
problems
- Watching
your script run
-
Keyboard Input and
Arithmetic
- read
- Arithmetic
-
Flow Control - Part
2
- More
branching
- Loops
- Building a
menu
-
Positional
Parameters
- Detecting command
line arguments
- Command
line options
- Getting an
option's argument
- Integrating
the command line processor into the
script
- Adding
interactive mode
- Flow Control - Part
3
|