LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Creating a login menu that set a users environment. (https://www.linuxquestions.org/questions/linux-server-73/creating-a-login-menu-that-set-a-users-environment-4175646682/)

abakwa 01-21-2019 11:06 PM

Creating a login menu that set a users environment.
 
Hello all

I have searched this site and although I have found some scripts to create login menus, none of these scripts seem to do what I am looking for. Most of the scripts will perform a specific task and then loop back to the main menu.

What I am looking for it that the login menu should set a user's environment and then proceed to the environment in the same terminal.

Say I have to environments on the same server:
1. A database environment.
2. An application environment.

When a user logs into the server I want the user to be presented with a menu to select their environment. If the user selects 1 for database environment then a bash profile is executed for the database environment and the user can continue in the same terminal.

At any point in the terminal, the user can type "main menu" to bring back the login menu so they can make a new selection.

Thanks for your help.

ondoho 01-22-2019 01:09 AM

so which files are being parsed at login?
on my system it's ~/.bash_profile amongst others.
it's a normal bash script, you can add your menu functionality there.

Quote:

Originally Posted by abakwa (Post 5951849)
At any point in the terminal, the user can type "main menu" to bring back the login menu so they can make a new selection.

that won't be easy.
why not just log out/in again?

abakwa 01-22-2019 12:25 PM

Quote:

Originally Posted by ondoho (Post 5951870)
so which files are being parsed at login?
on my system it's ~/.bash_profile amongst others.
it's a normal bash script, you can add your menu functionality there.


that won't be easy.
why not just log out/in again?


I also use the ~/.bash_profile and I have seen it done in another environment. Regret not to have copied the script. lol

These servers sometimes have 4-5 different things running on them. Just trying to find an easy way to switch between user environments by using a menu to execute the ~/.bash_profile behind the scene.

Thanks for replying.


All times are GMT -5. The time now is 01:42 AM.