Adding a “Press any key to continue” message to a script is actually quite easy because it’s already built into the
read command. Here’s a couple examples of how to use it:
#!/bin/sh echo "A First Method" read -s -n 1 -p "Press any key to continue..." # insert echo here for cleaner output echo echo "A Second Method" echo "Press any key to continue..." read -s -n 1 any_key echo "Now exiting" exit 0
Note: “any_key” was simply a made up name. It can be anything. As always, be sure to take a look at the man page for more information!