> The script: > #!/bin/bash > menu="1 first one 2 second one" > dialog --menu "MENU" 20 50 16 "$menu" > > Gives me: > Error: Expected at least 6 tokens for --menu, have 5. > > Normally I would do something like: > menu="1 \"first one\" 2 \"second one\"" > > but this is no go with dialog and bash, it adds whatever I put as part > of the text. > > Would you mind sending through a working sample? Perhaps I'm doing > something wrong!
Your problem is the blanks here. I'm sure there's a "good" way to un-fsck bash here, but I usually don't care because this part of bash is so ugly and complex (read the doc and note how many "if"s there are ... special cases and more special cases). So I'd simply do it like this and be done for: #!/bin/bash menu="1 first\ one 2 second\ one" echo "MENU" 20 50 16 $menu | xargs dialog --menu Note the backslash-blank combination. -- [email protected] mailing list
