Skip to content
New issue

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

How to run text menu script automatically on every reboot #3

Closed
tahirahmad1985 opened this issue Nov 15, 2017 · 1 comment
Closed

Comments

@tahirahmad1985
Copy link

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:"

  1. Option 1
  2. Option 2
  3. Option 3
  4. Quit

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

@ruanyf
Copy link
Owner

ruanyf commented Nov 16, 2017

You should put your script codes in ~/.bashrc.

@ruanyf ruanyf closed this as completed Nov 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants