Week 4 notes
Concepts
Shells - A shell is the primary interface to the kernel. There are many shells... /bin/sh, /bin/csh, /bin/zsh, /bin/bash, /bin/ksh
Scripts - A list of commands run from a text file. Programs or even other scripts can be run from scripts.
More usefull commands for scripts.
- sleep - wait for alloted time
- test - examine file types and compare values of string and numbers test -e filename or test 8 -ge $variable
- diff - compare two files, generate differance file
- [ - begin list evaluation [1,5,a-j]
- tee - accept input from pipe, write to a file, output to pipe
- awk - logical language often used in shell scripts
- expr - evaluate expressions expr 2 + 3
Borne shell
Borne shell built in commands
- ; - wait until preceding command is complete before continuing.
- * - wildcard, logically anything
- " " - exactly string in quotes
- ` ` - execute full contents of quotes when first quote is reached
- & - run program and return to shell
- | - redirect output from one program to another
- > - overwrite file on right with command on left
- >> - append file on right with command on left
Borne shell commands /bin/sh
- echo - print information and strings
- set - create new variable, read variable
- export - export variable into parent shell
- eval - mathamaticly evaluate
- umask - Block default permisions from envronment
- wait - wait for PID to terminate
- exec - run arguments in new shell