0

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?

2
Contributors
2
Replies
25
Views
4 Years
Discussion Span
Last Post by theashman88
1

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

echo "Error#: " 60"

to:

echo "Error#: " 60
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.