Sorry for my probably very naive question.
What I mean is: how to create an executable script/bash file that would run more complex commands, commands which must normally be put in a terminal?
Specifically, I am referring to the following commands:
- Learned about it from here:
DRI_PRIME=1 glxgears -info
That would start glxgears
and put to work the ATI discrete card. Then I can monitor its temperature etc. But when I run it from terminal, I get this:
While when I run it with the script
#!/bin/bash
DRI_PRIME=1 glxgears -info
only the gears window is visible, not the other one with text.
I would like to be able to use a bash file and have the first result, and then run the file from a launcher.
Considering this page on aria2
and webgui-aria2
, aria2
is started in that context by running in terminal a long command:
touch /path/to/download/folder/session.txt && aria2c --enable-rpc --rpc-listen-all --save-session=/path/to/download/folder/session.txt --input-file=/path/to/download/folder/session.txt -x16 -s16 -k1M --dir=/path/to/download/folder
How to run that with a script (that I would then execute from a launcher) and have the same result, the same info?
A script like so (adapted to my download folder)
#!/bin/bash
touch /home/cip/Downloads/aria2/session.txt && aria2c --enable-rpc --rpc-listen-all --save-session=/home/cip/Downloads/aria2/session.txt --input-file=/home/cip/Downloads/aria2/session.txt -x16 -s16 -k1M --dir=/home/cip/Downloads/aria2
gives nothing, while thhe programs starts.
(I'm in Xubuntu 14.04).
Best Answer
Consider this script (saved as
/home/muru/test.sh
):A basic launcher for this would look like (say, save it as
/home/muru/test.desktop
):Make them both executable:
Now you should have these two entries in your home folder:
Notice how the name is
glx-gears-info
even though the launcher's filename istest.desktop
. You can double click on it to start the script:For a script like (say, located at
/home/muru/start-aria.sh
):(I split the command into multiple lines for readability) the launcher file would look like (say
/home/muru/start-aria.desktop
):You can set
Terminal=false
here as this command probably doesn't need a terminal.To get the terminal window when using Xfce launchers, tick 'Run in Terminal'.
A second command, that would close aria2, can be added in the same Xfce launcher:
pkill aria2c
Also:
by adding them into a single launcher,
setting advanced properties like in the image below
(namely 'show last used item' and 'inside button'),
the launcher will always display the current status of aria2: running or closed.