LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 10:42 AM   #1
roddersg
LQ Newbie
 
Registered: May 2011
Posts: 2

Rep: Reputation: 1
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, 12:59 PM   #2
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,652

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

Rep: Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144Reputation: 3144
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 01:13 PM
Zenity list if statement meettitan Linux - General 3 05-01-2012 12:29 AM
[SOLVED] Reading lines to an array and generate dynamic zenity list jomann Programming 15 05-24-2011 11:40 PM
zenity editable list help technononsense Programming 1 07-22-2010 09:36 PM
Dymically determing the number of check list in Zenity, How? shivarajM Linux - Software 5 04-30-2009 07:57 AM

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

All times are GMT -5. The time now is 05:43 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration