Question : Linux bash_profile

have a questions about .bash_profile, I have a Universe database that is running on a RH linux. users login and the .bash_profile will send the user to the correct database. We have just one database that the users log into. We just created anohter database and I want to write a script that would give the users a choice on what database to log into. Any ideas, never really worked in sheel scripting before and unsure of the commands.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
# .bash_profile
 
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
 
# User specific environment and startup programs
 
PATH=$PATH:$HOME/bin
 
export PATH
unset USERNAME
times=`who | grep -c "^$LOGNAME "`
if [ $times -gt 7 ]; then
  echo "Sorry you have exceeded your 2 login limit."
  echo "Exiting now..."
  sleep 5
  kill -9 $$
fi
 
$date
cd /uv/cubs/dataabse
exec /uv/bin/uv

Answer : Linux bash_profile

This should work. Does the database come up in a GUI? Would it be better to have an xwindow come up?


PATH=$PATH:$HOME/bin
 
export PATH
unset USERNAME
times=`who | grep -c "^$LOGNAME "`
if [ $times -gt 7 ]; then
  echo "Sorry you have exceeded your 2 login limit."
  echo "Exiting now..."
  sleep 5
  kill -9 $$
fi
 
$date

while true; do
    echo "Please select the database you wish to use by pressing either the 1 or 2 button:"
    echo "1) Press the 1 button and hit return to open the CONRAD database....."
    echo "2) Press the 2 button and hit return to open the APONE database....."
    echo "E) Press the E button and press the return key to exit and close this session ....."
    echo

    read -p  "Please select CONRAD or APONE by pressing the 1 or 2 button, or E to exit, followed by the <ENTER> key. ->" DB
    case $DB in
        [1]* ) echo "You selected Database 1! Starting....." ; cd /uv/cubs/conrad; exec /uv/bin/uv;exit;;
# Old database commands separated with ; instead of new lines...
        [2]* ) echo "You selected Database 2! Starting..."; cd /uv/cubs/apone; exec /uv/bin/uv;exit;;
# New database commands...
        [eE]* ) echo "Exiting...";sleep 2;exit;;
        * ) echo "Please select CONRAD or APONE by pressing the 1 or 2 button, or E to exit.";;
    esac
done

Random Solutions  
 
programming4us programming4us