入力待ち処理(read)
処理の途中で入力を待ち、入力された文字を変数に格納する際に使用します。
read -p "[メッセージ]" [変数名]
read -p "Enter a username : " USER read -p "Enter the user password : " PASSWORD cat <<EOF -------------------------- Set the following information. USERNAME : $USER PASSWORD : $PASSWORD -------------------------- EOF read -p "Are you sure you want to use these settings? (Y/n): " SETUSER case "$SETUSER" in [yY]) echo "continue" ;; *) echo "Ends the process." ; exit 0 ;; esac