Frying Bacon (Bash Newbies)

= Example 1: fry1 = echo "Frying bacon."

= Example 2: fry2 = MEAT=bacon # The meat variable METHOD=Fry # The method variable echo $METHODing $MEAT.
 * 1) !/bin/sh
 * 1) Shell script to fry bacon
 * 2) introducing shebang, comments, vars, quoting

= Example 3: fry3 = MEAT="$1" METHOD="$0" ADVERB=$2 if test "fry3x" = "${METHOD}x" then METHOD='Fry' fi echo                  ${METHOD}ing       $MEAT       ${ADVERB} if [ -z $ADVERB ] ; then echo "(there was no \$ADVERB)" fi
 * 1) !/bin/bash
 * 1) Shell script to fry bacon
 * 2) introducing cmdline args, if, test, whitespace, backslash, command separators
 * 1) if [ "fry3x" == "${METHOD}x" ]
 * 2) if [ "fry3x" = "${METHOD}x" ]

= Example 4: fry4 = . fry.conf fry_bacon ${MEAT} "$METHOD" $ADVERB
 * 1) !/bin/bash
 * 1) Shell script to fry bacon
 * 2) introducing source, functions
 * 1) ./fry.conf
 * 2) source fry.conf

= Example: fry.conf = MEAT=bacon METHOD="Fry" ADVERB=boldly fry_bacon { echo                      ${1}ing       $2       ${3} if [ -z $3 ] ; then echo "(there was no \"ADVERB\")" fi }
 * 1) Fry bacon config file
 * 1) function fry_bacon {
 * 2) function fry_bacon {