|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
|
Thread Tools | Display Modes |
|
||||
That works only for a single argument, not multiple:
Code:
var='This is label' ls "${var}" # Works var='This is label' 'This is text' ls "${var}" # Oh noes! # cdialog --menu 'Hello World' 10 40 9 'I am Label' 'I am Text' 'Another label' 'More text' ... Where the highlighted text should be ${var} ... From the commandline this gives me: Code:
┌──────────────────────────────────────┐ │ Hello World │ │ ┌──────────────────────────────────┐ │ │ │ I am Label I am Text │ │ │ │ Another label More text │ │ │ │ │ │ │ └──────────────────────────────────┘ │ ├──────────────────────────────────────┤ │ < OK > <Cancel> │ └──────────────────────────────────────┘ It sounds silly, but putting 'I am Label' 'I am Text' 'Another label' 'More text' inside of ${var} has kept both myself and a coworker busy for quite some time (With no resolution so far)...
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. |
|
|||
Code:
j65nko@hercules[~]cat dialog var="\"This is label\" \"This is text\"" echo ${var} j65nko@hercules[~]sh dialog "This is label" "This is text"
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
||||
j65nko:
Yes, this works when echoing, but not with cdialog: Code:
[~]% cat test.sh #!/bin/sh var="\"I am Label\" \"I am Text\"" cdialog --menu 'Hello World' 10 40 9 ${var} echo ${var} [~]% sh test.sh ┌──────────────────────────────────────┐ │ Hello World │ │ ┌──────────────────────────────────┐ │ │ │ "I am │ │ │ │ Label" "I │ │ │ │ am Text" │ │ │ └──────────────────────────────────┘ │ ├──────────────────────────────────────┤ │ < OK > <Cancel> │ └──────────────────────────────────────┘ "I am Label" "I am Text" @graudeejs Other tools aren't available in this environment and are not an solution in this case. Trust me, if it would be, I would use them.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. |
|
||||
More prodding about produced this, which seems to work. The tip came from this old stackoverflow question, I'm still confused about what's going on though
Code:
#!/bin/sh cmd="cdialog --menu 'Hello World' 10 40 9 " list="I am Label|I am Text hello world|foo bar" IFS=" " for arg in ${list}; do label=$(echo ${arg} | cut -d '|' -f 1) text=$(echo ${arg} | cut -d '|' -f 2) cmd="${cmd} '${label}' '${text}'" done #echo ${cmd} eval ${cmd}
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. |
Tags |
/bin/sh, bourne shell, quotes |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
three problems :) | craze | OpenBSD Packages and Ports | 6 | 6th March 2011 03:26 PM |
GDM Problems | Saint | OpenBSD Packages and Ports | 4 | 29th August 2010 09:42 AM |
startup (rc) problems | kopcicle | OpenBSD General | 9 | 15th May 2010 08:35 PM |
GCC causing problems it seems. | Marred | FreeBSD Ports and Packages | 12 | 11th September 2008 08:11 AM |
ATI DRI problems | harisman | FreeBSD General | 16 | 11th May 2008 05:12 PM |