The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: Simple Script
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 04-26-2008
Vicky Narayan Vicky Narayan is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 21
Thumbs up

Quote:
Originally Posted by xplod4202 View Post
Here is the script that i am trying to run. I get an error and i can't figure out what is the problem.
#!/bin/bash

echo "What is your name"
read NAME

if [ $NAME -eq $Eugene ]; then
echo "My name is the same"
esle
echo "You have a nice name"
fi
Buddy,

The code is correct except that you have not declared the "Eugene" variable.
Hence its not able to compare the to variables so it might be throwing the error.
please use the below code:

#!/bin/bash

echo "What is your name"
read NAME
Eugene=Vicky
if [ $NAME -eq $Eugene ]; then
echo "My name is the same"
else
echo "You have a nice name"
fi

probably this would work. Please post the error if any....