- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- using "select var in " ??
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2009 11:35 AM
12-04-2009 11:35 AM
Here is what it looks like when it's ran:
WST MAIN MENU
==============
1) wsfplus
2) wsfplustrain
3) wstplus
4) wstplustest
5) wstplustrain
Select DBNAME:
Here is the code set:
if [ "${GROUPNAME}" != "sysadmin" ]
then
DIST=`grep ${LOGNAME} /etc/passwd |awk -F":" '{print $6}'|cut -d"/" -f3`
TEST=`echo ${DIST} |cut -c 1-2`
export DN=`echo $DIST| awk '{print toupper($1)}'`
echo $DN MAIN MENU
echo ==============
PS3="Select DBNAME:"
select dbname in `grep ${TEST}[a-z]plus dbs.txt`
do
if [[ -n $dbname ]];
then
export SPIDBNAME=$dbname
echo SELECTED DB is $SPIDBNAME
echo fpsv43 -v4.3 -d$SPIDBNAME
break
else
echo "Invalid Selection"
echo " "
fi
done
else
It's not pretty but it woulds.
Would like to gussy it up a bit, center it or \t\t\t\t over all output.. Chose to use select rather then building a large set of case statements..
I am trying to build a consolidated menuing system for my users, based on groups, I've worked through the group logic, just not the screen formats..
Any suggestions appreciated.
Solved! Go to Solution.
- Tags:
- select
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2009 11:45 AM
12-04-2009 11:45 AM
Re: using "select var in " ??
WST MAIN MENU
==============
1) wsfplus
2) wsfplustrain
3) wstplus
4) wstplustest
5) wstplustrain
Select DBNAME:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2009 11:47 AM
12-04-2009 11:47 AM
Re: using "select var in " ??
I would like every tabbed over 4 \t\t\t\t
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2009 11:52 AM
12-04-2009 11:52 AM
Re: using "select var in " ??
PS3=`echo '\t\t\t\t'` `echo SELECT DBNAME:"`
just not the select items..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2009 01:49 PM
12-04-2009 01:49 PM
Re: using "select var in " ??
I'm not fond of 'select' menus from the standpoint of aesthetics. I don't think you can offset or center your menu. Consider this case where simple spaces are used to apparently offset things:
#!/usr/bin/sh
select DBNAME in " wsfplus" " wsfplustrain" \
" wstplus" " wstplustest" " wstplustrain"
do
echo "you selected: [${DBNAME}]"
done
...the problem is that the selection returns the word with its leading spaces too which is probably not what you want. I suppose you could then trim the leading spaces.
As an aside, I would change the use of shell backticks (for command substitution) to $(...). For example, instead of:
# TEST=`echo ${DIST}|cut -c 1-2`
...use:
# TEST=$(echo ${DIST}|cut -c 1-2)
This improves readability.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2009 06:10 AM
12-07-2009 06:10 AM
Re: using "select var in " ??
I agree the aesthetics of the select is awful.
I am considering trying to do something with awk to build a CASE from an array within the menu. looking for example, where I could take the information grabbed from my dbname.list file, grep for the "district" and display a district specific menu.
I did get the PS3 formatted, like you I don't like the formatting.
Thanks I will take a look at re-vamping things with a CASE..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2009 06:46 AM
12-07-2009 06:46 AM
Solution> ...where I could take the information grabbed from my dbname.list file, grep for the "district" and display a district specific menu.
You might consider sourcing (reading) separate files that describe the requisite menu options along with the valid triggers for each. Your 'case' statement would invoke the appropriate file to source.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2009 08:37 AM
12-07-2009 08:37 AM