User input for execution of script

Hi,

I need to get the user input and execute a particular script based on the input provided.

For E.g. When I execute the script say Test.sh it should prompt "For which country I need to execute the script? (US/India)"

Based on the input as US or India from the user the execution of the steps in the script need to be done.

I have put some sample code can anyone please help me correct it and get the execution done successfully? How can I accept the user input ??

Code:

$ECHO $n "Enter the Country for which you want the installation to be executed? (US/India). $C"
if [ "${COUNTRY_SPEC}" = "US" -o "${COUNTRY_SPEC}" = "us"]
then
COUNTRY=US
else
COUNTRY=India
fi
echo -e "The installation is for $COUNTRY"

To accept user input use the read command immediately after your echo.

echo "Enter the Country for which you want the installation to be executed? (US/India). \c"
read COUNTRY_SPEC

if [ "${COUNTRY_SPEC}" = "US" -o "${COUNTRY_SPEC}" = "us" ]
then
COUNTRY=US
else
COUNTRY=India
fi

echo -e "The installation is for $COUNTRY"

might be clearer and more efficient to use a case sequence instead of a for loop.

that way, you could have the third entry for "*" to prompt for the correct country.

case $COUNTRY_SPEC in
US) .....;;
India) ....;;
*) echo "please enter correct country";;
esac

I have written the following code and the result as follows. Can you help? Thanks.

Code:
$ECHO $COUNTRY_SPEC "Enter the Country for which you want the installation to be executed? (US/India) $COUNTRY_SPEC"
read $COUNTRY_SPEC
if [ "${COUNTRY_SPEC}" = "US" -o "${COUNTRY_SPEC}" = "us"]
then
COUNTRY=US
else
COUNTRY=India
fi
echo -e "The installation is for $COUNTRY"

Result:
: No such file or directorye Country for which you want the installation to be executed? (US/India)
US
': not a valid identifier`
: command not found
./Test.sh: line 24: syntax error: unexpected end of file

Whats the value of your $ECHO variable? Could you run your script with set -x and post the output?
And please, do not doublepost

Not sure why you are trying to use $ECHO variable to echo a message to the screen. If you are only trying to prompt the user to enter a value then use this:

echo "Enter the Country for which you want the installation to be executed? (US/India) "
read COUNTRY_SPEC

when im just trying to echo as mentioned by you:
echo "Enter the Country for which you want the installation to be executed? (US/India) "
read COUNTRY_SPEC

I am getting:
line 1: ECHO: command not found

Make sure your echo command in your script is in lower case?

Like this:
echo "Some text"

Thanks alot.....