I'm trying to create a multi-column menu using Dialog in a Bash script. The man page offers this syntax:
Code:
--column-separator <string>: split data for ... menus on the occurrences of the given string
but leaves out the particulars or examples, nor have I been able to turn up any usage examples on the net. For example, is "string" wrapped in quotes? What characters are legal? And where exactly do I insert the string in my menu definitions?
Here's a menu that works:
Code:
#!/bin/bash
dialog --title " Welcome to My Menu! " \
--menu "" 19 40 12 \
"1" "Option One" \
"2" "Option Two" \
"3" "Option Three" \
"4" "Option Four" \
2>temp
Cancelled=$?
Choice=`cat temp` ; rm temp
if [ $Cancelled -eq 0 ]
then echo "You selected: $Choice"
else echo "You cancelled!"
fi
But when I try to add a column separator, for example this way:
Code:
#!/bin/bash
dialog --title " Welcome to My Menu! " \
--column-separator "@" \
--menu "" 19 40 12 \
"1" "Option One" \
"2" "Option Two" \
"@" "3" "Option Three" \
"4" "Option Four" \
2>temp
Cancelled=$?
Choice=`cat temp` ; rm temp
if [ $Cancelled -eq 0 ]
then echo "You selected: $Choice"
else echo "You cancelled!"
fi
It fails. The above, for example, just spits out "You cancelled!" and exits. Other attempts generally elicit syntax errors inside the --menu definition.
Can someone provide me with an example of the proper syntax for --column-separator? Thanks.
--Nathanael