Week 9 saw Andy delve further into utilizing the Unix shell followed by a tutorial on setting up the Apache HTTP server.

www.apache.org

On the unix shell, we explored shell scripts. The basics that we covered:

Pearl of the week – Common shell script errors:

[-z “$x”] error : no space near the [ ]’s
[ “$x”=”abc“ ] error : no space around =
y = 20 error : extra spaces around =

  • # -> comment character
  • x=y -> assign vaiable (no space)
  • shell keys words stored in .profile
  • Standard variables:
    • $$ the process id of the shell
    • $0 the name of the shell script (if applicable)
    • $1…$9 $n refers to the nth command line argument
    • $# contains the number of arguments
    • $* a list of all the command line arguments
    • $? Exit status (more on that shortly)
  • ; -> End of line
  • if, then, else, for, for in, if-then-elif, while, until, break continue, case, trap.

IF THEN ELSE:

IF THEN:
if [ $# -eq 0 ]
then
echo Error : at least one argument must be specified
exit 1
fi

FOR:

FOR IN:

IF THEN ELIF:

CASE:

UNTIL:

WHILE: