(SOLVED) How to create a launcher with consecutive commands?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
User avatar
ericramos1990
Level 3
Level 3
Posts: 183
Joined: Sun Jul 21, 2013 11:54 am

(SOLVED) How to create a launcher with consecutive commands?

Post by ericramos1990 »

Hi guys can anyone help me out?

I am trying to make a countdown timer with the sleep command and then having my music player (clementine) start with a song.

I came up with the following command:

sleep 10m && clementine '/home/eric/Music/Boom.mp3'

It works just fine in terminal, but I want to make it a simple launcher, but when I do, it just instantly closes.

I tried making launchers of the separate commands "sleep 10m" and "clementine '/home/eric/Music/Boom.mp3'" and they work, but when I make them into one single command with &&, it does not work.

I have tried making a launcher with the types "Application" and "Application in Terminal" and they both don't work.

Please give me your advice, thank you fellow minties =)
Last edited by ericramos1990 on Fri Aug 09, 2013 3:22 pm, edited 1 time in total.
Keep on tuxin' =)
User avatar
karlchen
Level 21
Level 21
Posts: 13809
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: How to create a launcher with consecutive commands?

Post by karlchen »

Hello, ericramos1990.

Create a simple shell script which executes the commands.

Code: Select all

#!/bin/bash
sleep 10m
clementine '/home/eric/Music/Boom.mp3'
Save the shell somewhere in your home folder. I use ~/Scripts. You might also use ~/bin. - You may have to create either folder.
Do not forget to make your script executable.

Code: Select all

chmod +x /path/to/scriptname
No need to tell you that you have to replace /path/to/scriptname by the real path and scriptname.
Finally create your launcher and tell it to execute the script.

HTH,
Karl
Image
Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
Seaside Rendezvous
User avatar
ericramos1990
Level 3
Level 3
Posts: 183
Joined: Sun Jul 21, 2013 11:54 am

Re: How to create a launcher with consecutive commands?

Post by ericramos1990 »

karlchen wrote:Hello, ericramos1990.

Create a simple shell script which executes the commands.

Code: Select all

#!/bin/bash
sleep 10m
clementine '/home/eric/Music/Boom.mp3'
Save the shell somewhere in your home folder. I use ~/Scripts. You might also use ~/bin. - You may have to create either folder.
Do not forget to make your script executable.

Code: Select all

chmod +x /path/to/scriptname
No need to tell you that you have to replace /path/to/scriptname by the real path and scriptname.
Finally create your launcher and tell it to execute the script.

HTH,
Karl
Hey Karl, thank you so much! Just starting Linux, and slowly learning new tricks. Thanks to you now I understand scripts somewhat, I am so excited to experiment and make my own!
Once again thanks! =)
Keep on tuxin' =)
User avatar
karlchen
Level 21
Level 21
Posts: 13809
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: (SOLVED) How to create a launcher with consecutive comma

Post by karlchen »

Hello, ericramos1990,

you're welcome and thanks for your feedback. :-)

Cheers,
Karl
Image
Linux Mint 19.3 64-bit Cinnamon, Total Commander 9.51 64-bit
Seaside Rendezvous
User avatar
pbanerjee
Level 1
Level 1
Posts: 22
Joined: Thu Dec 22, 2011 9:32 am

Re: (SOLVED) How to create a launcher with consecutive comma

Post by pbanerjee »

Not sure if this is best thread to ask my question.. will try out anyway.

I have a simple shell script that calls a package "apt-hotspot" to setup wifi hotspot on laptop using sudo login. The script is working fine when I run from command line.

My question is how can I execute my shell script from desktop without opening command line prompt?
I created a Launcher but it doesn't do anything.

Any idea buddys?

Cheers
Partho Banerjee
Linux Mint 15 Olivia
User avatar
pbanerjee
Level 1
Level 1
Posts: 22
Joined: Thu Dec 22, 2011 9:32 am

Re: (SOLVED) How to create a launcher with consecutive comma

Post by pbanerjee »

ok, I tried again using Desktop Launcher with "Run in Terminal" and it starts and executes correctly.
However, my script uses sudo to run a package. I don;t want the ecript to prompt for sudo password while executing. I have inserted "Here Document" within script that contacts my sudo password. But it is still prompting when I run from Desktop Launcher but doesn't prompt when I execute the script from command line.

My script:

Code: Select all

#!/bin/sh
sudo <<"EOF1"
MyPassword"\n"
EOF1
sudo ap-hotspot configure <<"EOF2"
ppp0
wlan0
MyWiFi
MyWiFiPassword
EOF2
sudo ap-hotspot start
How can I suppress the sudo password prompt when I execute from Desktop Launcher ?
Partho Banerjee
Linux Mint 15 Olivia
User avatar
catweazel
Level 19
Level 19
Posts: 9875
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: How to create a launcher with consecutive commands?

Post by catweazel »

karlchen wrote:

Code: Select all

chmod +x /path/to/scriptname
No need to tell you that you have to replace /path/to/scriptname by the real path and scriptname.
So why did you tell him? :mrgreen: :mrgreen: :mrgreen:
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
User avatar
ericramos1990
Level 3
Level 3
Posts: 183
Joined: Sun Jul 21, 2013 11:54 am

Re: (SOLVED) How to create a launcher with consecutive comma

Post by ericramos1990 »

LOL! My guess is that Linux users just can't help being awesome!
Keep on tuxin' =)
Post Reply

Return to “Newbie Questions”