Hey all, I'm a UNIX newb.
I've been trying to get this script to work for a class and there's no
competent being in this campus to help me out.
Here it is:
>A SCRIPT<
### Display a 2-line prompt for input until no input s received.
input="a"
nullvar=""
echo "Word and Character Counter..."
###To prompt user to type words
while [ $input -ne $nullvar ]
do
echo "Type one or two words, then press <Enter>"
echo "To end, just press <Enter>"
read input ###To exit program or display
count output
echo $input > crap ###Stores the read var into file 'crap'
if [ "$input" = "$nullvar" ] ###if empty then you will exit
then
echo Exiting Program...
else
echo You typed `cat crap | wc -w` words and `cat crap | wc -c`
characters
echo ###to insert blank line
fi
done
>A SCRIPT<
Basically, I'm trying to get input from keyboard, and that input has to be
either 1 or 2 words. If there is no input, the program exits. If there is
input, then the program counts the # of chars and # of words.
I would really appreciate the help... :)