I have a couple of links that i found useful in writing my shell scripts for bash:
Beginner's guide:
http://www.tldp.org/LDP/Bash-Beginne...tml/index.html
Advanced guide (more indepth than the one above):
http://www.tldp.org/LDP/abs/html/index.html
And another:
http://quong.best.vwh.net/shellin20/
And something i found very quick and easy for variables in bash:
http://www.linuxvoodoo.com/resources...eclareref.html
Shell scripts basically run commands from the console except you can put them into a script and manipulate multiple commands, set variables, make loops (for repeated commands that would otherwise be tedious), read and write to files easily, etc.
For example the command
Code:
$ echo "My name is Alex" >> ~/tmp/name.txt
would do the same thing as
Code:
#!/bin/bash
# This is the script
echo "My name is Alex" >> ~/tmp/name.txt
Now you can modify that and use command line arguments like
Code:
#!/bin/bash
# "$1" is the first command line argument indicating
# the name of the file to store this text in the folder ~/tmp/
echo "My name is Alex" >> ~/tmp/$1
It would be run like this:
$ sh thescript.sh filename.txt
or
$ ./thescript.sh filename.txt