Sponsored Content
Full Discussion: Creating a menu from find
Top Forums Shell Programming and Scripting Creating a menu from find Post 302160690 by i9300 on Tuesday 22nd of January 2008 11:50:48 AM
Old 01-22-2008
Ygor,
Thanks for the info. It is almost what I am looking for.
I am needing a menu with some dynamic items from find and other static items.
$DYNAMIC_ITEMS is where i will use my find, etc. For now i just set it.
The $DYNAMIC_ITEMS will be run in a similar fashion but the others will need to be run differently.
I was trying to use select choice and case and for loop.

1. This is with you code and the menu works.
Code:
DYNAMIC_ITEMS="fix_cron fix_ndd fix_sendmail.pid fix_serial fix_vftab ipmp.ksh new_bp_conf"
MENU_ITEMS="ALL CONFIGURATION $DYNAMIC_ITEMS MENU"
select CHOICE in $MENU_ITEMS
do
    [ $CHOICE ] && $ECHO $CHOICE
    break

done

Which produces :
Code:
 1) ALL
 2) CONFIGURATION
 3) fix_cron
 4) fix_ndd
 5) fix_sendmail.pid
 6) fix_serial
 7) fix_vftab
 8) ipmp.ksh
 9) new_bp_conf
10) MENU
POST INSTALL MENU:

The problem is that ALL items are run the same way, in this case $ECHO $CHOICE.

Here is my manual method:
Code:
#select CHOICE in Configuration uiss_test fix_cron fix_ndd fix_sendmail.pid fix_serial fix_vftab ipmp.ksh new_bp_conf ALL MENU Quit                                                                                                                       #do
#   case $CHOICE in
#   Configuration)  config;;
#   uiss_test)  config;$UISS_SCRIPTS_DIR/uiss_test;;
#   fix_cron)   echo fix_cron;;
#   fix_ndd)    echo fix_ndd;;
#   fix_sendmail.pid)   echo fix_sendmail.pid;;
#   fix_serial) echo fix_serial;;
#   fix_vftab)  echo fix_vftab;;
#   ipmp.ksh)   echo ipmp.ksh;;
#   new_bp_conf)    echo new_bp_conf;;
#   ALL)    echo ALL;;
#    MENU)  menu;;
#   Quit)  exit;;
#    *)  $ECHO "\nINVALID CHOICE:\n";;
#  esac
#done

Everything with exception of Configuration, ALL, MENU,and Quit should be dynamically created.
I also can't get your code to work inside of a case statement. Any help would be appriciated!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

creating a menu for recycling and permanently deleting files.

Trying to alias rm to move files to a hidden trash directory in the bash shell. I've tried to create this alias numberous ways and it's just not working. Here's what I've tried, anyone have any suggestions. alias rm='mv $* ~/.trash' alias rm= 'mv$* ~/.trash' things like that... I've also... (2 Replies)
Discussion started by: strmy_ngts
2 Replies

2. Shell Programming and Scripting

Creating menu list from configuration file

Hi folks, I have the following function ,which generates menu for installation type: select_install_type() { echo echo ======================================== echo Please select the type of installation: echo ======================================== ... (8 Replies)
Discussion started by: nir_s
8 Replies

3. Shell Programming and Scripting

Creating a menu within a script file

I am very new to Unix and know the basic commands. I have to write a script file and I'm completely lost. The script file is to show the following at the beginning: Menu of Options 1. Display all files in a user's home directory. 2. Welcome yourself to the program. 3. Display System... (8 Replies)
Discussion started by: sinjin
8 Replies

4. Shell Programming and Scripting

Creating a menu

Hi, I need your help co create a very small menu somthing that look like this: 1. first step 2. second step 3. last step from step : ___ to step : ___ If the user choose 1 --> it will echo : Hellow If the user choose 2 --> it will echo : World If the user choose 3 --> it will echo... (4 Replies)
Discussion started by: yoavbe
4 Replies

5. UNIX for Dummies Questions & Answers

Creating a List of Files With Find

Hi, I need to go through all the files on my system and build a list/output file with the paths of all files where the first two characters within the file match an expression. I know I can use something like find . | xargs cut -b1-2 or find . -exec cut -b1-2 {} \; to get the characters... (3 Replies)
Discussion started by: 008_
3 Replies

6. Shell Programming and Scripting

Menu in Menu script issue

Problem: I am trying to create a menu in a menu script and I am running into an issue with the calculator portion of the script. I am first presented with the ==Options Menu== which all 5 options working correctly. Now comes the fun part. I select option 1 which takes me to my ==Calculator... (1 Reply)
Discussion started by: iDdraig
1 Replies

7. Shell Programming and Scripting

Need help in create menu with 3 sub menu using the case command

hi all i am a newbie to this is there any examples on creating a main menu with 3 sub menu main menu -> option a , b and c a menu -> option 1 ,2 and 3 b menu -> option 1 ,2 c menu -> option 1 ,2 i am getting headache as my code kept getting unexpected EOF ---------- Post... (0 Replies)
Discussion started by: chercm
0 Replies

8. Shell Programming and Scripting

Need help creating a menu.

Hi Master of masters, Thanks for ur reply. Need ur help for following. Is it possible to create menu for following in linux or a function. > Look in logs > Status > Action > End Action > CONFSUCCESS > Success > Show message as successful > Enter to continue > CONFFAIL > Failure > Show... (1 Reply)
Discussion started by: rajeshwebspere
1 Replies

9. Shell Programming and Scripting

Creating bash script to process a data file based on the menu

Hey, im fairly new to unix and Im trying to make this unix project that would display a menu and do the following. MENU =========================== (p, P) Print users info (a, A) Add new user (s, S) Search user (d, D) Delete user (x,X) Exit Enter your choice: Trying to... (3 Replies)
Discussion started by: ultimaxtrd
3 Replies

10. UNIX for Beginners Questions & Answers

Gnome 3.28.3 menu item dissapears under the system menu

I installed CentOS 8 with Gnome 3.28.2 and I noticed that the "switch user" menu item disappeared from under the system menu of Gnome classic (Both X11 & Wayland). I checked google and this problem seems to have a history going back several releases of Gnome. Unfortunately, I never found a... (1 Reply)
Discussion started by: bodisha
1 Replies
echo(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.10 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 05:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy