Bash Equivalent of DOS’s Pause Command – How to Implement


I need a pause on a shell script to show a warning before continuing.
For instance, on DOS it goes like this:


echo 'Are you sure? Press Ctrl-C to abort, enter to continue.'

How can I do this on bash?
For the moment a sleep command seems to do the trick and is simple enough but is not exactly the idea:

echo 'Are you sure? Press Ctrl-C to abort.'
sleep 3

Best Answer

something along the lines of

echo -n "prompt"  #'-n' means do not add \n to end of string
read              # No arg means dump next line of input