LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-03-2017, 09:42 AM   #1
roddersg
LQ Newbie
 
Registered: May 2011
Posts: 2

Rep: Reputation: 2
zenity --list howto/help


I am trying to display the resolutions of my image files using zenity --list feature. No matter what I do, using embedded '\n' or even arrays nothing works. I started with the following bash script, changed it to arrays etc. I've put the references in at the end.

The result should be a pop-up with 3 columns (width, height, filename (with spaces)) ? Can anyone give me a heads-up?

-----------------------
#!/bin/bash
for f in *.jpg
do
result+=$(identify -format '%w %h "%i"\n' "$f")
done

zenity --list --column='Width' --column='Height" --column="Filename" ${result[@]}
-----------------------

References:
Bash Guide: http://mywiki.wooledge.org/BashGuide
Zenity: https://help.gnome.org/users/zenity/stable/list.html.en
 
Old 04-03-2017, 11:59 AM   #2
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Try replacing the zenity command with
Code:
echo $result
Is $result correct?
 
Old 04-03-2017, 01:10 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,703

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
Code:
zenity --list --column='Width' --column='Height" --column="Filename" ${result[@]}
' and " are not interchangeable. i.e --column='Height" will produce an error.

The \ in the example allows you to continue a long command on the next line which also increased readability. It isn't a newline character.

The normal column separator is a space so changing your
Code:
result+=$(identify -format '%w %h "%i"\n' "$f")
Code:
result+=$(identify -format '%w %h "%i" ' "$f")
Should fix your script.
 
  


Reply

Tags
bash, newline, zenity



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get zenity code if user close zenity window pedropt Programming 4 03-03-2017 12:13 PM
Zenity list if statement meettitan Linux - General 3 04-30-2012 11:29 PM
[SOLVED] Reading lines to an array and generate dynamic zenity list jomann Programming 15 05-24-2011 10:40 PM
zenity editable list help technononsense Programming 1 07-22-2010 08:36 PM
Dymically determing the number of check list in Zenity, How? shivarajM Linux - Software 5 04-30-2009 06:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration