1 |
> The script: |
2 |
> #!/bin/bash |
3 |
> menu="1 first one 2 second one" |
4 |
> dialog --menu "MENU" 20 50 16 "$menu" |
5 |
> |
6 |
> Gives me: |
7 |
> Error: Expected at least 6 tokens for --menu, have 5. |
8 |
> |
9 |
> Normally I would do something like: |
10 |
> menu="1 \"first one\" 2 \"second one\"" |
11 |
> |
12 |
> but this is no go with dialog and bash, it adds whatever I put as part |
13 |
> of the text. |
14 |
> |
15 |
> Would you mind sending through a working sample? Perhaps I'm doing |
16 |
> something wrong! |
17 |
|
18 |
Your problem is the blanks here. |
19 |
|
20 |
I'm sure there's a "good" way to un-fsck bash here, but I usually don't |
21 |
care because this part of bash is so ugly and complex (read the doc and |
22 |
note how many "if"s there are ... special cases and more special cases). |
23 |
So I'd simply do it like this and be done for: |
24 |
|
25 |
|
26 |
#!/bin/bash |
27 |
|
28 |
menu="1 first\ one 2 second\ one" |
29 |
echo "MENU" 20 50 16 $menu | xargs dialog --menu |
30 |
|
31 |
|
32 |
Note the backslash-blank combination. |
33 |
-- |
34 |
gentoo-server@g.o mailing list |