Pausing a bash script

I recently wanted to have a bash script file stop at the end of the command sequence so that I could check which disk directory was then active. There are at least two ways to achieve this.

(1) Use an echo – read command sequence

#!/bin/bash
echo “Shell command complete”
read

(2) Use the read command with a p(rompt) switch

#!/bin/bash
read -p “Shell command complete”

References:

read – Read a line from standard input
http://ss64.com/bash/read.html

How do I prompt for input in a Linux shell script?
http://stackoverflow.com/questions/226703/how-do-i-prompt-for-input-in-a-linux-shell-script

Advertisements
This entry was posted in Bash script. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s