473,396 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Bash

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.

Expand|Select|Wrap|Line Numbers
  1. #!/bin/bash
  2.  
  3. numfiles=1;
  4. dump='--title "XDIALOG BUILDLIST" --backtitle "A user-built list" \ --stdout --clear --separator "|" --buildlist "hello, this is a --buildlist..." 0 0 6 ';
  5.  
  6. function addfile {
  7.     FILE=`Xdialog --title "Please choose a file" --fselect /home 28 48`;
  8.  
  9.     case $? in
  10.         0)
  11.             FILES[${numfiles}]="$FILE";
  12.             numfiles=$numfiles+1;
  13.             addfile;;
  14.         1)
  15.             foonum=$numfiles;
  16.             for ((i=1;i<$foonum;i++)); do 
  17.               dump+="\ \"${i}\" \"${FILES[${i}]}\" \"off\" ";
  18.             done;;
  19.         255)
  20.             echo "Box closed";;
  21.     esac
  22. }
  23.  
  24. addfile
  25.  
  26.  
  27. result=`Xdialog $dump`;
  28.  
  29. retval=$?
  30. case $retval in
  31.   0)
  32.     echo "The user-built list is '$result'.";;
  33.   1)
  34.     echo "Cancel pressed '$result'.";;
  35.   255)
  36.     echo "Box closed '$result'.";;
  37. esac
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!
Jun 17 '07 #1
3 1914
arne
315 Expert 100+
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.

Expand|Select|Wrap|Line Numbers
  1. #!/bin/bash
  2.  
  3. numfiles=1;
  4. dump='--title "XDIALOG BUILDLIST" --backtitle "A user-built list" \ --stdout --clear --separator "|" --buildlist "hello, this is a --buildlist..." 0 0 6 ';
  5.  
  6. function addfile {
  7.     FILE=`Xdialog --title "Please choose a file" --fselect /home 28 48`;
  8.  
  9.     case $? indialog --title "Please choose a file" --fselect /tmp 0 0
  10.         0)
  11.             FILES[${numfiles}]="$FILE";
  12.             numfiles=$numfiles+1;
  13.             addfile;;
  14.         1)
  15.             foonum=$numfiles;
  16.             for ((i=1;i<$foonum;i++)); do 
  17.               dump+="\ \"${i}\" \"${FILES[${i}]}\" \"off\" ";
  18.             done;;
  19.         255)
  20.             echo "Box closed";;
  21.     esac
  22. }
  23.  
  24. addfile
  25.  
  26.  
  27. result=`Xdialog $dump`;
  28. dialog --title "Please choose a file" --fselect /tmp 0 0
  29. retval=$?
  30. case $retval in
  31.   0)
  32.     echo "The user-built list is '$result'.";;
  33.   1)
  34.     echo "Cancel pressed '$result'.";;
  35.   255)
  36.     echo "Box closed '$result'.";;
  37. esac
dialog --title "Please choose a file" --fselect /tmp 0 0

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!

Did you try to run your Xdialog commands directly from the command line (instead of from within a script)? This looks like an XDialog usage error rather than a bash scripting problem.

arne
Jun 17 '07 #2
I tried within the script only. However, I have tried to make it print out the code which is generating the buildlist and entered it directly into the terminal, and it worked.

I just went over to Zenity, which seems easier to me, and much more logical. So thanks for the help, but I don't need more help on Xdialog now :)
Jun 17 '07 #3
arne
315 Expert 100+
I tried within the script only. However, I have tried to make it print out the code which is generating the buildlist and entered it directly into the terminal, and it worked.

I just went over to Zenity, which seems easier to me, and much more logical. So thanks for the help, but I don't need more help on Xdialog now :)
Ok, no problem. Never heard about Zenity ... you never stop learning :)

arne
Jun 17 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Bernhard Kuemel | last post by:
Hi! To relief the problems of accessing a unix machine from behind a restrictive firewall or from an internet cafe I started to make a PHP web interface to bash. I'd like to hear your opinions...
5
by: Phil Powell | last post by:
I'm sorry but I can't figure out how to explain this any better than this. In PHP we have a command "require()" that obtains a file and logically places it into another file. I cannot figure...
3
by: John Bowling | last post by:
I have a java (2.0) program with the following lines: String cmdArray1 = {"lp", "-d", "hp4m", "MyFile"}; System.out.println(Runtime.getRuntime().exec(cmdArray1)); It compliles properly, but...
2
by: Eric Woudenberg | last post by:
I just installed a Python 2.3.4 Windows binary on a friend's WinXP machine (because the latest Cygwin-provided Python 2.3 build leaves out the winsound module for some reason). When I try and...
4
by: Tom Purl | last post by:
I just wrote a Python script that is going to be called from bash script. If the Python script fails, I want the bash script to also stop running. Unfortunately, I can't seem to get that to work. ...
11
by: Magnus Jonneryd | last post by:
Hi, I'm planning on writing a program that interactively is fed input via a shell (bash). I also want to be able to write a shell script that executes various commands related to my program. In...
16
by: John Salerno | last post by:
Hi all. I just installed Ubuntu and I'm learning how to use the bash shell. Aside from the normal commands you can use, I was wondering if it's possible to use Python from the terminal instead of...
6
by: Ishpeck | last post by:
I'm using Python to automate testing software for my company. I wanted the computers in my testing lab to automatically fetch the latest version of the python scripts from a CVS repository and...
4
by: melmack3 | last post by:
Hello My PHP script executes many bash/cmd commands. Functions like "exec()" or "system()" cause that new bash/cmd session is started, the command is executed and the session is closed....
6
by: Frantisek Malina | last post by:
What is the best way to do the regular bash commands in native python? - create directory - create file - make a symlink - copy a file to another directory - move a file - set permissions ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.