BASH: Provide a default value that the user can change
I wanted to be able to provide a default value that the user can change in a bash script and found this...
read -p "Name to deploy as: " -e -i "gitlab-runner" APP
echo ${APP}
Note that you need -e
for -i
to work as intended...
And you can confirm with something like:
read -r -p "Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1