Monthly Archives: May 2012

apropos . search manuals

commandline session

$ 4.2.20 4 207---> apropos "memory management"
XtAsprintf (3)       - memory management functions
XtCalloc (3)         - memory management functions
XtFree (3)           - memory management functions
XtMalloc (3)         - memory management functions
XtNew (3)            - memory management functions
XtNewString (3)      - memory management functions
XtRealloc (3)        - memory management functions
$ 4.2.20 5 208--->

$ 4.2.20 5 208---> apropos "source install"
libsrcinst (3)       - GNU Source Installer library API
sourceinstall (1)    - GNU Source Installer command line tool
$ 4.2.20 6 209---> apt-cache show sourceinstall
N: Unable to locate package sourceinstall
E: No packages found
$ 4.2.20 7 210--->

troubleshooting Part 1

commandline session

$ 4.2.20 5 176---> cat program.sh
#!/bin/bash
# trouble: script to demonstrate common errors
number=1
if [ $number = 1 ]; then
echo "Number is equal to 1."
else
echo "Number is not equal to 1."
fi
$ 4.2.20 6 177---> sh program.sh
Number is equal to 1.
$ 4.2.20 7 178--->

Missing Quotes

$ 4.2.20 8 179---> cat program.sh
#!/bin/bash
# trouble: script to demonstrate common errors
number=1
if [ $number = 1 ]; then
echo "Number is equal to 1.
else
echo "Number is not equal to 1."
fi
$ 4.2.20 9 180---> sh program.sh
program.sh: 9: program.sh: Syntax error: Unterminated quoted string
$ 4.2.20 10 181--->

Missing or Unexpected Tokens

$ 4.2.20 11 182---> cat program.sh
#!/bin/bash
# trouble: script to demonstrate common errors
number=1
if [ $number = 1 ] then
echo "Number is equal to 1."
else
echo "Number is not equal to 1."
fi
$ 4.2.20 12 183---> sh program.sh
program.sh: 6: program.sh: Syntax error: "else" unexpected (expecting "then")
$ 4.2.20 13 184--->

Unanticipated Expansions

$ 4.2.20 14 185---> cat program.sh
#!/bin/bash
# trouble: script to demonstrate common errors
number=
if [ $number = 1 ]; then
echo "Number is equal to 1."
else
echo "Number is not equal to 1."
fi
$ 4.2.20 15 186---> sh program.sh
program.sh: 4: [: =: unexpected operator
Number is not equal to 1.
$ 4.2.20 16 187--->

Note
Token (parser), usually a word or other atomic parse element.