We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This script has an output, which shows a text menu with few options 1,2,3..
What I want to do!!!
I want to run this script automatically and automatically selects option 2 on every start/reboot of Linux system.
I need some one to help me
#!/bin/bash
PS3='Please enter your choice: ' options=("Option 1" "Option 2" "Option 3" "Quit") select opt in "${options[@]}" do case $opt in "Option 1") echo "you chose choice 1" ;; "Option 2") echo "you chose choice 2" ;; "Option 3") echo "you chose choice 3" ;; "Quit") break ;; *) echo invalid option;; esac done
Output is as follows: "Choose your option:"
I also know that to run it automatically on every reboot, I need to give the complete path in /etc/rc.local file
But how to run this automatically on every reboot with automatic selection of option 2
The text was updated successfully, but these errors were encountered:
You should put your script codes in ~/.bashrc.
~/.bashrc
Sorry, something went wrong.
No branches or pull requests
This script has an output, which shows a text menu with few options 1,2,3..
What I want to do!!!
I want to run this script automatically and automatically selects option 2 on every start/reboot of Linux system.
I need some one to help me
#!/bin/bash
Bash Menu Script Example
PS3='Please enter your choice: '
options=("Option 1" "Option 2" "Option 3" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Option 1")
echo "you chose choice 1"
;;
"Option 2")
echo "you chose choice 2"
;;
"Option 3")
echo "you chose choice 3"
;;
"Quit")
break
;;
*) echo invalid option;;
esac
done
Output is as follows:
"Choose your option:"
I also know that to run it automatically on every reboot, I need to give the complete path in /etc/rc.local file
But how to run this automatically on every reboot with automatic selection of option 2
The text was updated successfully, but these errors were encountered: