LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-28-2004, 01:10 AM   #1
farmerjoe
Member
 
Registered: Oct 2004
Location: Texas
Distribution: Ubuntu - Home, RHEL4 - Server
Posts: 96

Rep: Reputation: 15
How to make a script wait for input


How do i make a script wait for user input to declare a variable?

like say i wanted it to do this:

What would you like the variable to be?
>test
Your variable is test.


I want to pause and wait for the user to input something that will declare a variable to be that input.

Any help is greatly appreciated. I am a n00b to all of this of course.

Thanks!
famerjoe

Last edited by farmerjoe; 12-28-2004 at 01:15 AM.
 
Old 12-28-2004, 01:24 AM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
'read' has to be made to timeout - otherwise it just waits. You can also 'sleep' to pause things but, as I say, it's not necessary with 'read'.
 
Old 12-28-2004, 01:34 AM   #3
farmerjoe
Member
 
Registered: Oct 2004
Location: Texas
Distribution: Ubuntu - Home, RHEL4 - Server
Posts: 96

Original Poster
Rep: Reputation: 15
can you give an example if it being used to wait for input and then storing that input into a variable?

Thanks!
famerjoe
 
Old 12-28-2004, 01:43 AM   #4
farmerjoe
Member
 
Registered: Oct 2004
Location: Texas
Distribution: Ubuntu - Home, RHEL4 - Server
Posts: 96

Original Poster
Rep: Reputation: 15
I think i have figured it out. Thanks for putting me on the right track!

-farmerjoe
 
Old 12-28-2004, 01:49 AM   #5
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
No problem.


Last edited by slakmagik; 12-28-2004 at 01:51 AM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I take input with a shell script? GUIPenguin Linux - General 4 04-11-2005 03:46 PM
How to make a script wait for input farmerjoe Linux - General 2 12-28-2004 05:18 AM
bash-script won't wait for application to finish TLV Linux - Software 24 09-30-2004 11:18 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
Pppd does not wait for chat script to finish ruchika Programming 1 08-28-2003 11:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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