There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Linux and Unix
Tag Cloud
access acer asus bios bsod computer crash driver drivers error ethernet excel freeze gaming google gpu graphics hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry repair router security slow software sound trojan usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
Solved: Sed Ksh Question

Reply  
Thread Tools
surfnschultz's Avatar
Member with 191 posts.
 
Join Date: Nov 2003
01-Jun-2005, 02:23 PM #1
Solved: Sed Ksh Question
I am trying to check keyboard input of the value y

echo " Please enter 1 or 2 to proceed /c"
read dec
if ($dec == y) then
if ($dec ~ y) then
if ($dec -eq y) then

I tried all these different things and all these fail saying the command is not correct. So help me out here How would I check a input of y ???

echo " Please enter 1 or 2 to proceed /c"
read dec
if ($dec -eq 1) then

This above works when I ask for an input of a numeric value like a 1 or 2 but when I substitute the y in the logical function/check it fails. Why???
tsunam's Avatar
Senior Member with 1,246 posts.
 
Join Date: Sep 2003
Experience: Linux~su
01-Jun-2005, 06:08 PM #2
this is the perfect time for a case statement

case $pornum in
y)
what you want it to do;;
n)
what you want it to do;;
esac

Note: I haven't tested to see if the case will work but should.

Last edited by tsunam; 01-Jun-2005 at 06:41 PM..
surfnschultz's Avatar
Member with 191 posts.
 
Join Date: Nov 2003
01-Jun-2005, 06:50 PM #3
gotta bail out right now, but I'll look at this more in the am. Thanks again Tsunam I really appreciate all your help on this stuff.
surfnschultz's Avatar
Member with 191 posts.
 
Join Date: Nov 2003
02-Jun-2005, 06:06 PM #4
Worked like a charm. Once again TSUNAM you are the MAN!!!!!!

THANK YOU so much for all the help you have provider me. I am so stoked to have this community it has been a blessing.
tsunam's Avatar
Senior Member with 1,246 posts.
 
Join Date: Sep 2003
Experience: Linux~su
02-Jun-2005, 06:24 PM #5
Glad to be of help. Agree with the community being a blessing, I've learned a good ammount from the people here.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 06:27 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.