Hello. I am using the latest Cygwin release and the Bourne Again Shell. I am writing a DOS DIR clone to make ls easier. Here is what I have so far:
#
# MYDIR
# Version 1.0
# By Pietro Gagliardi
#
# SYNTAX:
# mydir [-h] [-c]
#
# PARAMETERS:
# -h - Provides help
# -c - Lists files in columns with suffices
#
# DESCRIPTION:
# mydir is a quick equivalent to ls that executes ls in a certain way.
# It works two ways:
# 1) When used by itself, it shows a list of all the files in this
# directory in the standard UNIX table style.
# 2) When used with the -c switch, it shows a columned list of all
# the files in this directory in multiple columns, where each
# item has any of the following suffices:
# / - A directory
# @ - A symbolic link
# * - Executable
# None - A file
# There is also a manual-page-style help available with the -h option.
#
# VERSION HISTORY:
# Version 1.0 (Started November 24, 2005; Completed ?)
# - First Release, with three modes (mydir = ls -aLl, mydir -c = ls -aCF,
# mydir -h = help)
#
# TODO:
# - Fix error with \?)
# - Finish help printing
while getopts hc: option
do
case option
in
h) ;;
c) ls -aCF; exit 0;
\?)
if [ "$#" -eq 0 ]
then
ls -aLl
exit 0
else
echo 'mydir - Unkown parameters!'
fi;;
esac
done
echo "\n"
echo "MYDIR\nVersion 1.0\nBy Pietro Gagliardi\n"
echo "\nUSAGE:\n"
echo " mydir [-h] [-c]\n"
echo "\nPARAMETERS:\n"
echo " -h - Provides help\n"
echo " -c - List files in columns with suffices\n"
echo "\nDESCRIPTION:\n"
It gives me this error:
./mydir: line 43: syntax error near unexpected token `)'
./mydir: line 43: ` \?)'
Why?
For the Software You Want, AMPERSAND LABORATORIES is the place!