Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 03-09-2006, 01:28 PM   #1
Registered: Oct 2005
Distribution: Slackware
Posts: 228

Rep: Reputation: 40
script 'prompting with timeout' question

I know how to have a bash script prompt a user and save it in a variable.

echo -n "Please enter your name: "
read $NAME
The question is how to do so with a timeout period (let's say 5 seconds), after which the variable can receive some default value.

Thanks for any suggestions.
Old 03-09-2006, 01:37 PM   #2
Senior Member
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,353

Rep: Reputation: Disabled
read -t secs NAME

If NAME has a value before prompt and timeout occurs it will keep same value

Last edited by dive; 03-09-2006 at 01:38 PM.
Old 03-09-2006, 01:44 PM   #3
Registered: Oct 2005
Distribution: Slackware
Posts: 228

Original Poster
Rep: Reputation: 40
Thanks for the reply. I tested it and it works great.


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
Socket timeout (c question) alaios Programming 13 09-11-2005 12:43 PM
Question on FTP 421 no transfer timeout enjoyzj Linux - Networking 2 06-04-2004 11:24 AM
Wireless hotspot client timeout script Joffe Linux - Wireless Networking 0 04-14-2004 11:12 AM
PHP script timeout J_Szucs Linux - Software 4 01-22-2004 05:10 PM
scripting help: boot script, loopback password, timeout undecipherable Programming 3 12-18-2002 11:15 AM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:56 PM.

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