Sometimes you learn something new and ask yourself : how is it possible I’ve never seen this before. Zenity is a tool that allows you to display Gtk+ dialog boxes from the command line and through shell scripts. Here is a rather crude example:
#!/bin/sh
ORATAB=/etc/oratab; export ORATAB
ORAENV=/usr/local/bin/oraenv;export ORAENV
# Set this in accordance with the platform
db=`if [ ! $ORATAB ] ; then
echo "$ORATAB not found"
exit 1;
fi
(cat $ORATAB |grep -v "^$" | while read LINE
do
case $LINE in
\#*) ;;
*) echo FALSE
echo $LINE | awk -F: '{print $1}'
;;
esac
done) |
zenity --list --text "Choose a database" --radiolist --column "Pick" --column "Database" --width=300 --height=300`
un=`zenity --entry \
--title="Username for $db " \
--text="Enter your _username:" \
--entry-text "system"`
pw=`zenity --entry \
--title="Add an Entry" \
--text="Enter your _password for $db:" \
--entry-text "password" \
--hide-text`
zenity --question \
--text="Are you sure you wish to logon on $db as $un?"
if [ $? ]
then
ORACLE_SID=$db;export ORACLE_SID
ORAENV_ASK=NO;export ORAENV_ASK
$ORAENV $db
sqlplus $un/$pw@$db
fi
Run this script:



