Shell Scripting is a Programming Language for Shells.

See safe use of the shell for some good tips.

Understanding I/O streams numbers

The Unix / Linux standard I/O streams with numbers:

HandleNameDescription
0stdinStandard input
1stdoutStandard output
2stderrStandard error

Redirecting the standard error (stderr) and stdout to file

Use the following syntax:

command-name &>file
# or
command > file-name 2>&1