Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-11-2010, 08:06 PM   #1
LQ Newbie
Registered: Feb 2010
Posts: 9

Rep: Reputation: 0

Not sure why this won't work, any thoughts?

echo enter the letter A or the letter B
read letter
if["$letter" = "A"]; then
echo "coolit's an A"
elif["$letter" = "B"]; then
echo "not cool it's a B"
echo "You MESSED UP!"
Old 02-11-2010, 08:28 PM   #2
Senior Member
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 4,856

Rep: Reputation: 826Reputation: 826Reputation: 826Reputation: 826Reputation: 826Reputation: 826Reputation: 826
"Won't work is broad", how doesn't it work?

There must be a space between 'if' and '['
Comparison might work with '=', yet it is clearer to use '=='
Run your script with 'sh -x <scriptname>



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 > Forums > Linux Forums > Linux - Newbie

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

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