Results 1 to 3 of 3
Hi....
i have two scripts called:
"type" & "selecttype".
In "type" i have only the name of the products ex.: product1 & product2. Now, i have to ADD product3 which ...
- 03-19-2010 #1Just Joined!
- Join Date
- Mar 2010
- Posts
- 5
Adding New Selections to the existing Script
Hi....
i have two scripts called:
"type" & "selecttype".
In "type" i have only the name of the products ex.: product1 & product2. Now, i have to ADD product3 which includes sub categories: productA, productB, productC, productD, productE, productF. so my New type script (menu) looks as below:
and my current selectype looksCode:1) product1 2) product2 3) product3
My question is how can I add the new product3 argument with all other multiple selections (productA, productB, productC, productD, productE, productF) into my current selectype (as below which is set only for product1 & product2), so when a user select: 3) product3 from "type" would get a new menu of all the sub categories, and the script would process the new additional arguments.
Here is the copy of my selectype script:
Code:#!/bin/sh echo SELECTTYPE export -n selecttypechoice if [ "${upgrade}" == "yes" ] ; then selecttypechoice=${upgrade_type} else [ -a ./types ] if [ $? = 0 ] ; then #### Select Type from types file echo --title \"$installproductchoice Server Role\" --menu \"Select Role to install\" 20 48 6 > /tmp/selecttype.dialog for vpackages in `cat types`; do if [ "$typesexception" = "" ] ; then echo \"$vpackages\" Role >> /tmp/selecttype.dialog; else echo $typesexception | grep -i "$vpackages" if [ $? = 0 ] ; then echo . else echo \"$vpackages\" Role >> /tmp/selecttype.dialog; fi fi done; dialog --file /tmp/selecttype.dialog 2> /tmp/selecttype.choice if [ $? = 0 ] ; then export selecttypechoice=`cat /tmp/selecttype.choice`; else export -n selecttypechoice; fi reset echo selecttypechoice $selecttypechoice if [ "$selecttypechoice" = "" ] ; then echo Aborted: User Aborted while selecting a $installproductchoice Role echo .........Try again !! exit ; fi fi fi
**** Thank you in advance for your help!!
- 03-19-2010 #2Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
I'm not really helpful to solve your problem the way you want. I think that bash scripting does not exist to manage these kinds of jobs. You might consider some programming language based on GUI, like Qt/C++, Java, Basic...
Not tsaying it cannot be done in Bash but it's not bash's vocation. If you really want to go on with Bash, you'd better use loops and functions, each for a particular task, like show a dialog, process input... instead of a big one-way monolithic code where you can't get back to a desired step.0 + 1 = 1 != 2 <> 3 != 4 ...
Until the camel can pass though the eye of the needle.
- 03-20-2010 #3Just Joined!
- Join Date
- Mar 2010
- Posts
- 5
Ok guys i tried lots of other ways but so far nothing. what i did is created a file called pro3types but the script starts & by pass the file. i added +x to file ran the process but still no luck.
i was wondering what else i should change to get the menu to the sub-categories of product3 after users selecting it. here is the code:
Code:#!/bin/sh echo SELECTTYPE export -n selecttypechoice if [ "${upgrade}" == "yes" ] ; then selecttypechoice=${upgrade_type} else [ -a ./types ] if [ $? = 0 ] ; then ##### Select Type from types file echo --title \"$installproductchoice Server Role\" --menu \"Select Role to install\" 20 48 6 > /tmp/selecttype.dialog for vpackages in `cat types`; do if [ "$typesexception" = ""] ; then echo \"$vpackages\" Role >> /tmp/selecttype.dialog; else if [ "selecttypechoice" = " product3 "] ; then [ ./pro3types ] else echo $typesexception | grep -i "$vpackages" if [ $? = 0 ] ; then echo . else echo \"$vpackages\" Role >> /tmp/selecttype.dialog; fi fi fi done; dialog --file /tmp/selecttype.dialog 2> /tmp/selecttype.choice if [ $? = 0 ] ; then export selecttypechoice=`cat /tmp/selecttype.choice`; else export -n selecttypechoice; fi reset echo selecttypechoice $selecttypechoice if [ "$selecttypechoice" = "" ] ; then echo Aborted: User Aborted while selecting a $installproductchoice Role echo .........Try again !! exit ; fi fi fi


Reply With Quote