Alex Schuster wrote:
Andrew writes:


In a script I'm writing, it writes to the file /tmp/dlgmenu:


hda "Auto-partition drive /dev/hda"


but in the script when I do:


dialog --menu 12 50 8 `cat /tmp/dlgmenu` 2> /tmp/menuoption


Isn't there a first parameter missing, the menu's name?

I was posting code from memory. The actual code is:


dialog --menu "Choose a partition..." 12 60 8 `cat /tmp/dlgmenu` 2> /tmp/menuoption

It creates 2 menu items. The first one ends at 'partition' and the 2nd
one starts at 'drive'. But when I manually do:


dialog --menu 12 50 8 hda "Auto-partition drive /dev/hda" 2>
/tmp/menuoption

it works just fine. Anyone have any idea what's going on?

After the size arguments, two (or 4, 6, 8...) arguments are expected, but cat returns the whole file as a single one. You could do it like this, with two lines in the file:
echo -e "hda\nAuto-partition drive /dev/hda" > /tmp/dlgmenu
tag=`cat /tmp/dlgmenu | head -1`
item=`cat /tmp/dlgmenu | tail -1`


dialog --menu mymenu 12 50 8 "$tag" "$item" 2> /tmp/menuoption

Do you need the /tmp/dlgmenu file at all?

Yes. The menu is built dynamically. /tmp/dlgmenu could contain:


hda "Auto-partition drive /dev/hda" sda "Auto-partition drive /dev/sda" ...

--
Andrew Gaffney


-- [EMAIL PROTECTED] mailing list



Reply via email to