Hello
I am trying to learn bash, and have found Xdialog to make them look better. But when I was experimenting with this code I couldn't get it to work.
What I want to do is to let the user choose several files, and then export it to a buildlist. But it gives me an erro and shows the helpfile:
"Xdialog: missing list parameters !"
Any help is appreciated!
I am trying to learn bash, and have found Xdialog to make them look better. But when I was experimenting with this code I couldn't get it to work.
Code:
#!/bin/bash
numfiles=1;
dump='--title "XDIALOG BUILDLIST" --backtitle "A user-built list" \ --stdout --clear --separator "|" --buildlist "hello, this is a --buildlist..." 0 0 6 ';
function addfile {
FILE=`Xdialog --title "Please choose a file" --fselect /home 28 48`;
case $? in
0)
FILES[${numfiles}]="$FILE";
numfiles=$numfiles+1;
addfile;;
1)
foonum=$numfiles;
for ((i=1;i<$foonum;i++)); do
dump+="\ \"${i}\" \"${FILES[${i}]}\" \"off\" ";
done;;
255)
echo "Box closed";;
esac
}
addfile
result=`Xdialog $dump`;
retval=$?
case $retval in
0)
echo "The user-built list is '$result'.";;
1)
echo "Cancel pressed '$result'.";;
255)
echo "Box closed '$result'.";;
esac
"Xdialog: missing list parameters !"
Any help is appreciated!
Comment