Register
It is currently Thu Dec 14, 2017 6:22 pm

How to enter commands to run a script not from terminal


All times are UTC - 6 hours


Post new topic Reply to topic  [ 8 posts ] 
Author Message
 PostPosted: Thu Mar 31, 2016 1:28 am   

Joined: Tue Mar 29, 2016 9:48 am
Posts: 26
Dear all
I can write a script that when I type in terminal -for exampel- my_firefox; then open the firefox. But how can do that in non-terminal environment. Indeed, my idea is to type my_firefox in everywhere of the GUI like Desktop, Home directory and ... and open the firefox based on that script that is running in background. Is it possible?


Top
 Profile  
 PostPosted: Thu Mar 31, 2016 5:39 am   
Moderator
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 265
Location: London - UK
I use an ubuntu clone, alt-F2 brings up a mini command prompt, maybe that's kinda what you're after.
Or maybe you mean a desktop icon, either way it seems the GUI configs is the place to start.


Top
 Profile  
 PostPosted: Thu Mar 31, 2016 5:59 am   

Joined: Tue Mar 29, 2016 9:48 am
Posts: 26
Thanks for replying. Maybe my not-good English makes hard to explain exactly what is in mind. My idea is a script that works on background and consist of some functions that will be shortcuts; e.g. my_firefox, my_vlc and so on. Such that when I type in every location or situation, open firefox or vlc. For example, [Alte]+Home in ubuntu open the nautilus as default. I want to construct a generalization of such shortcuts for myself.

I do not mean kinds of Desktop Entries. Also, I tried to make shortcuts in some DE' like xfce for this purpose. But don't work.


Top
 Profile  
 PostPosted: Thu Mar 31, 2016 9:46 am   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 560
Code:
#send a command, a loop or a function to background
# just add &
somescript &   # runs in background
# but messages still appear on terminal
# and if foreground process ends, background jobs are killed
jobs   # list running background jobs
fg      # put last job sent to background on foreground again.


# a job running totaly independent from any terminal
nohup  somescript
# output will be gathered in well known file
# read
man nohup


Top
 Profile  
 PostPosted: Thu Mar 31, 2016 12:39 pm   

Joined: Tue Mar 29, 2016 9:48 am
Posts: 26
Thanks uhelp. I studied about jobs and nohup today. But I think that nohup can not help me. My idea is similar to something like xbindkeys. Or, maybe I had not a good study.


Top
 Profile  
 PostPosted: Thu Mar 31, 2016 3:04 pm   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 560
So what is the real problem?

Just type "firefox" in a terminal,
or use suggested <alt><f2> hotkey?


Top
 Profile  
 PostPosted: Fri Apr 01, 2016 1:26 am   

Joined: Tue Mar 29, 2016 9:48 am
Posts: 26
Please consider this situation: I want to type a sequence of keys like myfirefox not in terminal, when Desktop in in front and results opening the firefox. Similar the hotkeys, but not the hotkeys. I tried in Gnome too. But when try to set a shortcut myfirefox it says:
Image


Top
 Profile  
 PostPosted: Fri Apr 01, 2016 6:25 am   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 560
Hotkeys are the right way then.

Read docs about it.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 15 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:  
cron


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