LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-14-2003, 07:16 PM   #1
vapor
Member
 
Registered: Jul 2003
Distribution: SuSe
Posts: 38

Rep: Reputation: 15
if then statements


say i wanted to ask a yes or no question and print diffent answers depending on the answer..... how would i go about do that

bash script


all help is appreciated
 
Old 07-14-2003, 07:21 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
http://www.tldp.org/LDP/abs/html/tests.html

Have fun reading ;)

Cheers,
Tink
 
Old 07-14-2003, 07:47 PM   #3
vapor
Member
 
Registered: Jul 2003
Distribution: SuSe
Posts: 38

Original Poster
Rep: Reputation: 15
it didnt help... thanks there
 
Old 07-15-2003, 01:57 AM   #4
Mohsen
Member
 
Registered: Feb 2003
Location: Iran
Distribution: Solaris 10
Posts: 201

Rep: Reputation: 30
#!/bin/bash
#I'm rather newbie in bash script

echo Enter yes or no please
read var
if ["$var" = yes]
then
echo You entered yes
elif ["$var" = no]
echo You entered no
else
echo Can not evaluate answer
fi
 
Old 07-16-2003, 06:44 AM   #5
dharmender_rai
Member
 
Registered: Aug 2002
Location: Pune,India
Posts: 39

Rep: Reputation: 15
also you can use "case" instead of "if" .
 
  


Reply



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
if else statements 0.o Programming 7 09-27-2005 02:59 PM
if statements and case statements not working in bourne shell script mparkhurs Programming 3 06-12-2004 02:41 AM
Why my else statements always run? lectraplayer Programming 9 04-02-2004 11:38 AM
if statements thesnaggle Linux - Software 1 02-16-2004 09:52 AM
How do I use X =< Y w/ IF statements? dolvmin Linux - Software 11 09-24-2003 10:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:00 PM.

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