[Solved] Create shortcut to a bash script?

Forum rules
Before you post please read how to get help
Post Reply
FrankB616
Level 2
Level 2
Posts: 75
Joined: Wed Mar 27, 2019 1:50 pm

[Solved] Create shortcut to a bash script?

Post by FrankB616 » Thu May 23, 2019 9:49 pm

I have been using Linux for close to 20 years, but almost entirely with KDE. I am presently using Mint 19.1 xfce.

In KDE, I could easily create a desktop icon or shortcut that would run a bash script for synchronizing the /data directories on the machines on my LAN with rsync.

How do I do this in xfce?

This is the last piece of the puzzle before I move to Mint 19.1 xfce on all 6 of my machines.

Thanks.

Frank.
Last edited by FrankB616 on Sat Jun 01, 2019 7:58 pm, edited 1 time in total.

gm10
Level 18
Level 18
Posts: 8726
Joined: Thu Jun 21, 2018 5:11 pm

Re: Create shortcut to a bash script?

Post by gm10 » Thu May 23, 2019 10:27 pm

I know nothing about Thunar but there is always the command line: man ln.

Or simply move the script itself to the desktop, I'm not sure why it needs to be linked in the first place.

ajgringo619
Level 6
Level 6
Posts: 1386
Joined: Thu Mar 01, 2018 8:36 pm
Location: San Diego, California

Re: Create shortcut to a bash script?

Post by ajgringo619 » Thu May 23, 2019 11:42 pm

Open Thunar, right-click on the script, select Send to then Desktop (Create Link).
Mint 19.2 XFCE
kernel 4.15.0-64-generic
AMD FX-8350 Eight-Core w/16 GB RAM
Nvidia GeForce 960 w/2GB RAM (435.21)
Image

FrankB616
Level 2
Level 2
Posts: 75
Joined: Wed Mar 27, 2019 1:50 pm

Re: Create shortcut to a bash script?

Post by FrankB616 » Sat Jun 01, 2019 7:58 pm

Dragging and dropping worked great!

Thank you!

FrankB616
Level 2
Level 2
Posts: 75
Joined: Wed Mar 27, 2019 1:50 pm

Create shortcut to a bash script?

Post by FrankB616 » Sun Aug 11, 2019 10:42 pm

OK, I can make a common bash script run with the techniques shown here. But it runs 'blind'.

I have one script that requires me to input a password before it will connect to another computer on my LAN. I need the script to run in a terminal window so that I can give it that input. I also want to keep an eye on the file copy progress, which means I need it to run in a visible terminal.

I can make it work by using a context menu from Thunar and choosing "open with" Terminal emulator, and that will open a terminal, of course. However, I would like to be able to do this from a desktop shortcut rather than go through the 4 or 5 steps needed to do it manually.

Thanks.

Frank.

gm10
Level 18
Level 18
Posts: 8726
Joined: Thu Jun 21, 2018 5:11 pm

Re: [Solved] Create shortcut to a bash script?

Post by gm10 » Mon Aug 12, 2019 3:08 am

Right click the shortcut > Properties > double click the entry > check the box to run in a terminal at the bottom > Save
Tune up your LM 19.x: ppa:gm10/linuxmint-tools

FrankB616
Level 2
Level 2
Posts: 75
Joined: Wed Mar 27, 2019 1:50 pm

Re: [Solved] Create shortcut to a bash script?

Post by FrankB616 » Mon Aug 12, 2019 9:53 am

Screenshot_2019-08-12_07-46-52.png
Sorry, but I am a bit confused. The shortcut is the one I created on the desktop by dragging the shellscript file from thunar to the desktop. When I right click and choose 'properties', I end up with the attached dialog box. Which entry do I double click? I tried all of them, and could not find a box 'run in a terminal' anywhere.

Frank.

gm10
Level 18
Level 18
Posts: 8726
Joined: Thu Jun 21, 2018 5:11 pm

Re: [Solved] Create shortcut to a bash script?

Post by gm10 » Mon Aug 12, 2019 9:57 am

Oh, you just had created a link, not a .desktop file, sorry for not paying attention. Anyway, what you do is instead of a link you create a desktop launcher (by right-clicking the desktop), and then in that launcher properties window as the command give the full path to your script and below that you find the checkbox to run in a terminal.
Tune up your LM 19.x: ppa:gm10/linuxmint-tools

FrankB616
Level 2
Level 2
Posts: 75
Joined: Wed Mar 27, 2019 1:50 pm

Re: [Solved] Create shortcut to a bash script?

Post by FrankB616 » Mon Aug 12, 2019 2:39 pm

That got it! Thank you!

Now, can it be set to keep the terminal open upon completion so that I can pick up any error messages? At the moment the terminal window closes when the script reaches the end.

Thanks!

Frank.

gm10
Level 18
Level 18
Posts: 8726
Joined: Thu Jun 21, 2018 5:11 pm

Re: [Solved] Create shortcut to a bash script?

Post by gm10 » Mon Aug 12, 2019 2:59 pm

FrankB616 wrote:
Mon Aug 12, 2019 2:39 pm
Now, can it be set to keep the terminal open upon completion so that I can pick up any error messages? At the moment the terminal window closes when the script reaches the end.
Several ways that can be done, but the easiest is to do it in the script itself, e.g. by adding something like this at the end:

Code: Select all

read -p "Press Enter to close..."
Tune up your LM 19.x: ppa:gm10/linuxmint-tools

FrankB616
Level 2
Level 2
Posts: 75
Joined: Wed Mar 27, 2019 1:50 pm

Re: [Solved] Create shortcut to a bash script?

Post by FrankB616 » Wed Aug 14, 2019 2:59 pm

Will do!

Thanks again!

Frank.

Post Reply

Return to “Xfce”