How can I make "Press any key to continue"
You can use the read
command:
read -p "Press enter to continue"
As mentioned in the comments above, this command does actually require the user to press enter; a solution that works with any key would be:
read -n 1 -s -r -p "Press any key to continue"
Explanation by Rayne and wchargin
-n
defines the required character count to stop reading
-s
hides the user's input
-r
causes the string to be interpreted "raw" (without considering backslash escapes)
As @cas wrote in a comment, you really should use less
for this. If the changelog is more than one page, you really want a pager anyway.
You normally want to consult the PAGER
environment variable instead of just calling less
:
${PAGER:-less} changelog
will use $PAGER
if it is set and less
otherwise.
read -rsn1 -p"Press any key to continue";echo
Or, if you actually need the REPLY
variable:
read -rsn1 -p"Press any key to continue" variable;echo
Replace variable
with a variable name you don't need.