Bash Bourne Again Shell The Bourne Again Shell was created for use in the GNU project. The GNU project was started by Richard Stallman of the Free Software Foundation in an effort to create a free version Unix for the ix86 along with all of the required utilities. Bash was intended to be the standard shell for this GNU system. When the complete GNU system failed to materialize Linux came on the scene and it adopted Bash as its standard shell. Bash is also available for pretty much every other Unix system and for Microsoft Windows. I. Pipes and Redirections a. Stdin, Stdout, Stderr Every programs has three open "files" to start out with........ b. Redirections Redirections allow you to take these three things and point them to other "files". Output redirection cat names sort names > sorted_names sort nofile > outie1 # Get an error sort nofile 2> outie2 # No error....or is there? sort names2 >> sorted_names ls -laR /home > files ls -laR /home 2> errors ls -laR /home &> both ls -laR /home/ 1> files 2> errors #to 2 files Input Redirection ./readthings < names # Makes assignments easier. c. Pipes -- Allow one to connect the stdout of one program to the stdin of the next cut -d: -f1 /etc/passwd cut -d: -f1 /etc/passwd | sort cut -d: -f1 /etc/passwd | sort > users II. Job Control -- Multitasking a. Ctrl Z b. jobs c. fg, bg III. Variables # Assigning, derefferencing a. Shell Variables Variable only available to the current program. -- envvar b. Environment Variables Variable available to the current or and of its child programs IV. Aliases -- in your .bashrc alias pn='pine' alias yakko='ssh zaphod@yakko.cs.wmich.edu' alias l='ls' alias ll='ls -la' V. Functions a. Can easily be used as multi-command aliases. # Take some from work b. Can be used in scripts VI. Scripts # Must be executable a. Control Structures 1. test or [ # no spaces for assignment. Spaces necessary for comparison. 2. if/else # You can find a complete list of test options at # http://library.psyon.org/os/linux/abs-guide/ 3. for # Not like for loops in other languages. You can't itterate from # 1 to 10 for example 4. while and until 5. case 6. select b. Doing Math c. Backticks, quotes, Here-Documents? Reference URLS BASH Programming - Introduction HOW-TO http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html Advanced Bash-Scripting Guide http://library.psyon.org/os/linux/abs-guide/