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 12-11-2007, 08:25 PM   #1
sfmadmax
LQ Newbie
 
Registered: Dec 2007
Posts: 7

Rep: Reputation: 0
SHell Script Help! When reading input from a user


Currently I have a portion of a script... its looped with a while-do loop hence for the "breaks"



echo "Are you sure you wish to delete this APP ? (y or n)"
read DELETEME
case $DELETEME in
y|yes|Y|YES)
echo "Deleting OS"
break
;;
n|no|N|NO)
echo "Returning to Main Menu, Press Enter to Continue"
;;
*)
echo "Unknown answer returning to the Main Menu, Press E
nter to Continue"
;;
esac


My question is.. When I run this script and this question is asked. My answer is displayed on a new line. Is there any way I can make my answer display on the same line as the question???

So it would look like this

Are you sure you wish to delete this APP ? (y or n) : y

instead of

Are you sure you wish to delete this APP ? (y or n)
y


-Thanks
 
Old 12-11-2007, 08:41 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Use 'echo -n' with 'read -p'?
 
Old 12-11-2007, 09:09 PM   #3
sfmadmax
LQ Newbie
 
Registered: Dec 2007
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks unSPAWN that did it..
 
Old 12-12-2007, 01:03 AM   #4
LlNUX
Member
 
Registered: Oct 2007
Location: Sydney, Australia
Distribution: Debian
Posts: 63

Rep: Reputation: 15
what is the read -p ? Just out of curiosity !!

I thought you can make it without it :bash

thanks
 
  


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
input into bash script(reading path) dalicros Linux - General 3 05-30-2007 07:54 PM
Help Please - averging input in a shell script reddawn Linux - Newbie 2 07-16-2006 02:44 PM
how can I take input with a shell script? GUIPenguin Linux - General 4 04-11-2005 04:46 PM
Shell script user input tuckermaddox Linux - Newbie 5 08-12-2004 04:14 AM
Shell Script: Reading Pdf files funkymunky Programming 8 06-18-2004 04:34 PM

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

All times are GMT -5. The time now is 12:47 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