![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| awk user input | gefa | Shell Programming and Scripting | 17 | 10-30-2007 02:01 AM |
| Getting user input | stevefox | Shell Programming and Scripting | 3 | 02-15-2007 11:09 PM |
| making sure input are digits | bebop1111116 | High Level Programming | 1 | 10-21-2006 02:32 PM |
| Accepting User Input | scott78 | Shell Programming and Scripting | 1 | 01-13-2004 11:54 AM |
| Wait for input | keelba | UNIX for Dummies Questions & Answers | 0 | 04-26-2002 08:44 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I need a script to halt at the end and wait for the user to hit a key...could be any ket or enter. I know it can be done but I am just starting out.. Thanks
|
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
echo "Hit return to continue"
read dummy_variable |
|
#3
|
||||
|
||||
|
To allow them to continue after hitting any key, I usually create a function (I usually call it readOne, after the function I stole the idea from
Code:
readOne () {
tput smso
echo "Press any key to return \c"
tput rmso
oldstty=`stty -g`
stty -icanon -echo min 1 time 0
dd bs=1 count=1 >/dev/null 2>&1
stty "$oldstty"
echo
}
blah blah ... readOne blah blah exit 0 HTH |
|
#4
|
||||
|
||||
|
Interesting use of dd. Nice post.
|
|
#5
|
||||
|
||||
|
Very interesting. I've never seen a way to read a single character from a shell script before. But I want to be able to actually catch the character that is typed. So I changed the dd statement to:
result=`dd bs=1 count=1 2>/dev/null` which seems to be working. Very cool trick! |
|
#6
|
|||
|
|||
|
Hi,
Well I was trying to see what exactly the script Livinfree posted is doing. I couldnt understand. Using man I could get that tput smso and rmso is for getting standout mode seq started and end it. dd bs sets the blcok size to 1.But why I didnt undertand. Is it because the requirement is that only ONE keystroke is required. however I couldnt understand how the rest of these work when put together. Could anyone pls explain. Thanks. |
|
#7
|
|||
|
|||
|
and I am a fool it seems...Was looking at todays thread and dont know why I ended up on a thread 2 years old!
Sorry folks....Ignore my previous mail... by mistake I thought this thread is new. Thanks |
|||
| Google The UNIX and Linux Forums |