View Single Post
  #7   (View Single Post)  
Old 27th September 2011
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default

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.
Reply With Quote