Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 27 Nov 2014, 20:37
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
problem when using ls in gtkdialog..
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
hannysabbagh

Joined: 14 Apr 2013
Posts: 17

PostPosted: Mon 03 Jun 2013, 11:03    Post subject:  problem when using ls in gtkdialog..  

Hello.

i have wrote a command to list all gtk2 themes in /usr/share/themes:

ls -d /usr/share/themes/*/gtk-2.0 | awk -F"/gtk-2.0" '{print $1}'

the problem is when i try to put this command as an input command for comboboxtext, of course it will give me a Synatex error because of the '

so i tried to use a variable like $thing='{print $1}' , and in comboboxtext:

ls -d /usr/share/themes/*/gtk-2.0 | awk -F"/gtk-2.0" "$thing"

this way works very good on the terminal, but in gtkdialog it doesn't work, it gives me ls: write error: Broken pipe

any help ?
thanks.[/code]
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 887

PostPosted: Mon 03 Jun 2013, 11:59    Post subject:  

hannysabbagh,

You can do it with a function -
Code:
#!/bin/sh

theme_list() {
ls -d /usr/share/themes/*/gtk-2.0 | awk -F"/gtk-2.0" '{print $1}'
}

export -f theme_list

GTKDIALOG=gtkdialog
export MAIN_DIALOG='
<vbox>
  <hbox>
    <text>
      <label>Combobox:</label>
    </text>
    <comboboxtext>
      <variable>COMBOBOX</variable>
      <input>theme_list</input>
    </comboboxtext>
  </hbox>
  <hbox>
    <button ok></button>
    <button cancel></button>
  </hbox>
</vbox>
'

$GTKDIALOG --program=MAIN_DIALOG


Cheers,
s
Back to top
View user's profile Send private message 
hannysabbagh

Joined: 14 Apr 2013
Posts: 17

PostPosted: Mon 03 Jun 2013, 13:05    Post subject:  

hello seaside.

i know that you can do that, but the problem is that i need only the theme name, not its full directory, like:"Crux,Adwitia.." not "/usr/share/themes/crux"...

thank you.
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 887

PostPosted: Mon 03 Jun 2013, 15:12    Post subject:  

hannysabbagh,

Perhaps this.
Code:
ls -d /usr/share/themes/*/gtk-2.0 | awk -F"/" '{print $5}'

Cheers,
s

EDIT: I'm not really sure what you're looking for because you could do this by " ls /usr/share/themes/".
Back to top
View user's profile Send private message 
hannysabbagh

Joined: 14 Apr 2013
Posts: 17

PostPosted: Mon 03 Jun 2013, 16:08    Post subject:  

Thank you my friend, it is now working correctly Smile
Thanks.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0511s ][ Queries: 12 (0.0095s) ][ GZIP on ]