LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-16-2005, 03:14 PM   #1
PhantomFX
LQ Newbie
 
Registered: Feb 2005
Location: England
Distribution: SuSE
Posts: 2

Rep: Reputation: 0
Help With A Shell Script Error


Can somebody help me with this script please. I'm sorry if it's in the wrong forum but I'm new and couldn't find another relevant forum. I've been trying to write a shell script in a bash shell and when I execute it I get these errors:

./trident: line 13: yes=: command not found
./trident: line 16: yes=: command not found

I tried to fix it myself but just kept getting different errors so can somebody fix it for me please?

echo "Hello. Welcome To The New Text Based Registration System."
echo "Please Enter You First Name"
read fname
echo "Thankyou"
echo "Please Enter Your Surname"
read lname
echo "Thankyou"
echo "Please Enter Your Company Name Or Employer's Company"
read cname
echo "Name: $fname $lname Company/Employer: $cname"
echo "Is This Information Correct"
read yn1
if $yn1= yes
then
echo "Information Stored. Thankyou For Your Time"
elif $yn1= no
then
echo "Please Repeat Process"
until $yn1= yes
do
echo "Please Enter You First Name"
read fname
echo "Thankyou"
echo "Please Enter Your Surname"
read lname
echo "Thankyou"
echo "Please Enter Your Company Name Or Employer's Company"
read cname
echo "Name: fname lname Company/Employer: cname"
echo "Is This Information Correct"
read yn1
done
else
echo "Please Enter 'yes' Or 'no'"
echo "Error Detected Exiting Program"
fi

I'm new at this so it could all be completely wrong but I just want to learn and fix it. I've done some other scripts but when I tried to include a loop its gone wrong thanks in advance to anyone who replys.
 
Old 02-16-2005, 03:19 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
You probably want to use quotes:
Code:
if [ "$yn1" = "yes" ]; then
 echo Yes
else
 echo no
fi
 
Old 02-17-2005, 04:10 AM   #3
PhantomFX
LQ Newbie
 
Registered: Feb 2005
Location: England
Distribution: SuSE
Posts: 2

Original Poster
Rep: Reputation: 0
Thanx very much. Finally it works properly. Thanx again for the help.
 
Old 02-17-2005, 04:42 AM   #4
heema
Senior Member
 
Registered: Sep 2003
Location: Egypt
Distribution: Arch
Posts: 1,528

Rep: Reputation: 47
and in the future if have any troubles or questions regarding shell scripts then please post them in the programming forum
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script help required syntax error sridhar11 Programming 1 10-31-2005 08:38 AM
Installing JBuilder, but get error regarding Shell Script Sir Nerdalot Linux - Software 1 07-12-2005 09:21 AM
shell script q's (io, error exiting ) dave bean Programming 6 02-17-2005 01:24 AM
Shell Script Error Gerardoj Linux - General 2 12-03-2003 09:44 AM
Shell script error. chuck77 Linux - General 3 11-29-2001 11:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration