I have a script which uses a Menu file (containing several different Menus). I start out with
and grep my VRMenuData file for
Code:
$Menu\:code:$txtring
, where txtring contains the value entered from the keyboard, and cut that line for the code I want executed. So my data looks like:
Quote:
Main:code:1:declare Menu=Download
Main:code:2:soffice -calc VRSched.ods
Main:code:3:echo Load Refresh Menu here
|
My code acting on the data looks like:
Code:
`grep $Menu\:code:$txtring VRMenuData | cut -d: -f4`
When I chose options 1 thru 3, that executes with no problem (Menu=Download does not work). The program sees into field four, but field four is not able to see outside itself. For instance:
Code:
Download:chan:
Download:pitm:1:echo $numpi\. Return to Main Menu
Download:pitm:2:
Download:pitm:3:
Download:pitm:4:echo Enter Menu number (q quits):
Above is more of the VRMenuData file. The
is used to generate a numbered list of channels. It could be four or 40. Whatever the number is, I want the next line to read, for example, 32. Return to Main Menu.
is the variable in the script I use to number the list of channels. The number following Download: pitm: is numpi, which should be added to num. How do I take
Code:
Download:pitm:1:echo $numpi\. Return to Main Menu
from my VRMenuData file and generate
Code:
32. Return to Main Menu
?
Code:
$ declare -p Menu
declare -- Menu="Download"
$ declare -p numpi
declare -- numpi="1"
$ grep $Menu\:pitm:$numpi VRMenuData | cut -d: -f4
echo $numpi. Return to Main Menu