Computing.Net > Forums > Unix > Enter key in unix

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Enter key in unix

Reply to Message Icon

Name: Neeraja
Date: June 24, 2005 at 03:18:36 Pacific
OS: HP UX
CPU/Ram: 256
Comment:

Hello All,

Can you help me in capturing the enter key in the script?

For eg :
echo "Press Enter to continue :"

-> after this the script should wait until the user presses enter and then will continue once the user press Enter..

How do i acheive this?

Regards,
Neeraja



Sponsored Link
Ads by Google

Response Number 1
Name: Jim Boothe
Date: June 24, 2005 at 07:19:30 Pacific
Reply:

A read statement (into a variable) will wait for a prompt.  Check the variable for the user's input (if desired):

echo "Press Enter to continue: \c"
read reply

if [ ! "$reply" ] ; then
   echo "The user pressed Enter"
else
   echo "The user entered: $reply"
fi


0
Reply to Message Icon

Related Posts

See More


Shell Script Problem UNIX Scripting in the bou...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Enter key in unix

cancel the enter key in a text www.computing.net/answers/unix/cancel-the-enter-key-in-a-text-/7344.html

how to open int explorer in unix www.computing.net/answers/unix/how-to-open-int-explorer-in-unix/7241.html

Need drivers for DFE-530TX in UNIX! www.computing.net/answers/unix/need-drivers-for-dfe530tx-in-unix/2251.html