I'm trying to make a bash script that asks me a question and, if I respond y, executes the subsequent scripts; but, if I respond n, it terminates "ALL" of the subsequent script.
I already created the bash script, but when I respond with n, the following scripts, build and anotherBashScript, are executed.
package.json
"scripts": {
"prebuild": "./ask.sh",
"build": "vite build",
"postbuild": "./anotherBashScript.sh"
},
ask.sh
read -p "Are you sure you want to build the app? (y/n) " yn
case $yn in
[yY] ) echo Building the app...
break;;
[nN] ) echo exiting...;
exit 1;;
* ) echo invalid response;;
esac