Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash user input yes no

### simple yes no question
read -p "Are you sure? " -n 1 -r
echo    # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
    exit 1
fi

### most widely used method
while true; do
    read -p "Do you wish to install this program?" yn
    case $yn in
        [Yy]* ) make install; break;;
        [Nn]* ) exit;;
        * ) echo "Please answer yes or no.";;
    esac
done

### select from yes/no menu
echo "Do you wish to install this program?"
select yn in "Yes" "No"; do
  case $yn in
    Yes ) make install;;
    No ) exit;;
  esac
done
Comment

PREVIOUS NEXT
Code Example
Shell :: flutter doctor android studio not installed 
Shell :: run postgresql command line maccos 
Shell :: pip install from github ssh 
Shell :: github jabba 
Shell :: present working directory in shell script 
Shell :: find image size terminal 
Shell :: pause in bash 
Shell :: npm install composition apiu 
Shell :: mac terminal hide username 
Shell :: git fetch remote branch 
Shell :: how to check installed apps in ubuntu 
Shell :: install rails 
Shell :: grepcc coin 
Shell :: change owner of file in linux 
Shell :: kali find devices on network 
Shell :: powershell script path 
Shell :: add user to group linux 
Shell :: git push all tags 
Shell :: open jupyter notebook with anaconda in powershell 
Shell :: instalacion de angular cli 
Shell :: get podman ubuntu 
Shell :: git increase buffer size 
Shell :: visual studio code update git password 
Shell :: sed add line after match 
Shell :: restart wsl 
Shell :: remove git from project in windows 
Shell :: brew install golang-migrate 
Shell :: put bash script execution output in a file 
Shell :: remote desktop connection wsl2 
Shell :: docker sudo how to add user 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =