Register
It is currently Wed Oct 22, 2014 5:53 pm

search and execute


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Wed May 05, 2010 7:02 pm   

Joined: Tue May 04, 2010 9:22 pm
Posts: 1
hello everyone,
i am planning on making a "launcher" script that will execute applications by searching the contents of a *.desktop file (either in ~/.config/autostart or /etc/xdg/autostart) i intend to search for the pattern 'Exec' and then execute its arguments just like how it's executed as an ordinary command in the terminal (i.e. /opt/foo/bin/foo), unfortunately, i don't know how yet (though i've done search and replace using sed, i know nothing about search and execute or search and pass-to-variable then execute). any suggestions? thanks!


Top
 Profile  
 PostPosted: Fri May 14, 2010 8:27 am   
User avatar

Joined: Tue Apr 27, 2010 2:28 pm
Posts: 172
Location: Czech Republic
You can use sed to search for the command and then pipe this command to bash, c.f.:
Code:
echo $'random text\nExec ls\nrandom text' | sed -n '/^Exec /{s/^Exec //;p}' | bash


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 3 guests


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 post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP