4. shell standard
IEEE POSIX and Open Group shell specification
http://www.opengroup.org/onlinepubs/9699919799/nframe.html
All of these mean the same thing:
POSIX.1-2008
IEEE Std 1003.1-2008
Open Group Technical Standard Base Specifications Issue
7"
5. bash
shell that interprets certain default commands and that provides
programmatic tools to write custom commands that don't exist
can be used interactively (user types commands) or non-
interactively (commands saved in a file)
respects POSIX.1-2008 standard
maintained by Chet Ramey at the moment
7. bash feature summary 1/2
source:http://tiswww.case.edu/php/chet/bash/bash-intro.html
editing and completion
history and command re-entry
job control
functions and aliases
arrays
arithmetic
ansi c quote expansion
tilde expansion
brace expansion
substring capabilities
9. bash breakdown of tasks
read text (terminal, file, string)
find words and operators
parse tokens into commands
expand certain tokens into lists
filenames
commands
arguments
handle redirections
execute commands
wait for completion, or not
10. bash: types of expansions
tilde
~
variable
str=abcdefgh; echo ${str:-3:2}
command
echo `date`
process
cmp < (echo "my life") <(echo "your life")
arithmetic
str=abcdefgh; echo ${str:((-3)):2}
brace
echo sp{el,il,al}l
15. readline
bash + readline = productivity
readline allows you to make edits to commands
maintained by Chet as well
typically gets updated along with bash
17. readline: take home
C-b move back one
C-f move forward one
C-d delete character I'm on
C-u undo last keystroke (infinitely)
C-a go to begin of line
C-e go to end of line
M-f jump forward (word)
M-b jump backward (word)
C-l clear screen, but keep my line
plenty more..
18. bash tips
Execute your script, after marking it executable
chmod +x myscript.sh; ./myscript.sh
21. bash tips
Redirect output and error to different files
. myprogram 1>myoutput 2>myerrors
To the same file
. myprogram >&alloutput
. myprogram &>alloutput
22. bash tips
First or last few lines
head novel_that_i_started_but_didnt_finish
tail novel_that_i_started_but_didnt_finish
tail +1000 novel_that_i_started_but_didnt_finish
tail +1000 --lines=2000 novel_that_i_started_but_didnt_finish
23. bash tips
First or last few lines
head novel_that_i_started_but_didnt_finish
tail novel_that_i_started_but_didnt_finish
tail +1000 novel_that_i_started_but_didnt_finish
tail +1000 --lines=2000 novel_that_i_started_but_didnt_finish