I'm having some error in my code but I can't understand what the problem is.

#!/bin/bash
ARG_COUNT=$#
EXP_ARGS=2

if [ $ARG_COUNT -eq $EXP_ARGS ]; then

    echo "The correct number of parameters was passed: " $EXP_ARGS"."
    echo "My name is: "$1 $2"."

else

    echo "Incorrect number of command line arguments. We have: "        $ARG_COUNT " parameter(s), but we need: "$EXP_ARGS " parameter(s)."
    echo "Error#: " 60"
fi

ct=1
while [ $ct -le $ARG_COUNT ]

do
    echo "Counting up to the parameter count limit: " $ct
    let "ct+=1"

done

The error I keep getting says:
./arg.sh: line 21: unexpected EOF while looking for matching `"'
./arg.sh: line 24: syntax error: unexpected end of file

Any ideas?

Recommended Answers

All 2 Replies

Yes, on line 13 remove the last quote, so change this:

echo "Error#: " 60"

to:

echo "Error#: " 60
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.