Bash, cómo hacer una pregunta y responder acorde en un script
Jump to navigation
Jump to search
echo 'Pregunta? (s/N)'
read runCommandQuestion
# Next line sets default value to 'N' to avoid warnings in the if
[ -z $runCommandQuestion ] && runCommandQuestion=N
if [ $runCommandQuestion == "y" ] || [ $runCommandQuestion == "Y" ]
then
runCommand=y;
else
echo 'Doing nothing...'
exit 1
fi