LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-08-2015, 01:39 PM   #1
tux'sbestfriend
LQ Newbie
 
Registered: Nov 2015
Posts: 2

Rep: Reputation: Disabled
create a shell script with a menu


I use OpenVPN which is great, but every time I restart my computer I have configure it by typing sudo openvpn --config <name of config file>. Obviously this is not practical and so I would like shell script to do this for me. It would be simple if it weren't for two things. First: OpenVPN prompts me for a username and password, it would be really great if I didn't have to enter it manually. I have tried every thing I can think but no success. Second: there are options such as service provider and server. It would be helpful to have a menu, something for example similar to the grub boot options screen. My friend is working on something that relies on the ability to navigate the menu using the arrow keys. So I thought I would post for both of us. Lastly please explain the way your suggestions work. Thanks
 
Old 11-08-2015, 04:33 PM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,987

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
You probably could use bash's dialog utility to do what you want. This should get you going in the right direction:

http://www.linuxjournal.com/article/2807
 
Old 11-09-2015, 06:12 AM   #3
tux'sbestfriend
LQ Newbie
 
Registered: Nov 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
reply

Thanks. Looks like a good option! I still would appreciate help with my second problem.
 
Old 11-09-2015, 08:07 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
I think you mean the first problem as the dialog option was to solve the second problem.
 
Old 11-09-2015, 08:15 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,632

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by tux'sbestfriend View Post
I use OpenVPN which is great, but every time I restart my computer I have configure it by typing sudo openvpn --config <name of config file>. Obviously this is not practical and so I would like shell script to do this for me. It would be simple if it weren't for two things. First: OpenVPN prompts me for a username and password, it would be really great if I didn't have to enter it manually. I have tried every thing I can think but no success.
Read the "Question Guidelines" link in my posting signature. If you have tried everything, you certainly should have something to POST HERE, to show us what you've scripted so far. We aren't going to write a script for, but will be glad to help.
Quote:
Second: there are options such as service provider and server. It would be helpful to have a menu, something for example similar to the grub boot options screen. My friend is working on something that relies on the ability to navigate the menu using the arrow keys. So I thought I would post for both of us. Lastly please explain the way your suggestions work. Thanks
There are THOUSANDS of bash-scripting tutorials you can find, along with examples of menu-driven scripts. The VERY FIRST HIT in Google for "bash script with menu" is:
http://askubuntu.com/questions/1705/...a-shell-script

...complete with an example.
 
Old 11-09-2015, 08:24 AM   #6
hortageno
Member
 
Registered: Aug 2015
Distribution: Ubuntu 22.04 LTS
Posts: 240

Rep: Reputation: 67
Create a file /path/to/credentials with the username and password each in its own line and put this into your config file

Code:
auth-user-pass /path/to/credentials
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a menu in a shell script upnort Programming 12 08-13-2015 04:42 PM
Menu bashed shell script for users shell 0.o Linux - Server 6 02-14-2013 06:00 AM
[SOLVED] Script question: create a shell script in kde to log in on a server with ssh c4719929 Linux - Newbie 1 01-31-2011 03:05 AM
How do I create a Non-GUI, Script Menu ruined Linux - Newbie 4 12-30-2008 03:36 PM
shell script menu marsIV Programming 1 10-09-2007 08:56 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration