Score:0

Why is my launcher not working for this script? ubuntu 20.04

ph flag

I have a spript "poweriso.sh" that works fine double clicking in the directory.

 export LD_LIBRARY_PATH=.

 export QT_QPA_PLATFORM_PLUGIN_PATH=.

 ./poweriso

 unset LD_LIBRARY_PATH

That is how the file came in the download. I added

  #!/bin/bash

It did not matter.

I have a .desktop file "poweriso.desktop" that wont launch it.

 [Desktop Entry]

 Type=Application

 Terminal=true

 Name=Power ISO

 Icon=/mnt/Linux-stuff/poweriso-x64/iso.png

 Exec=/mnt/Linux-stuff/poweriso-x64/poweriso.sh

I think I see a flash of the gui but it does not run.

It does not show in proccesses after trying to run.

.desktop is in ~/.local/share/applications and it shows in launcher menu.

I have been looking at it a long time. Please help.

cocomac avatar
cn flag
Side note: You should [add a shebang](https://stackoverflow.com/a/10383546) so the system knows what kind of script it is, and how to run it - tl;dr put `#!/usr/bin/env bash` by itself as the first line of your script
treyiii avatar
ph flag
@cocmac That did not help.
hr flag
I doubt it will work with relative paths `.` and `./poweriso` - either change those to absolute paths, or it may possibly work as-is if you add a `Path=` specification to your .desktop file to set the working directory
treyiii avatar
ph flag
@steeldriver I am stuck on stupid. Can you give examples with the information I have given?
Score:1
cn flag

The command

./poweriso

you indicated in the script to the system means: "find an executable poweriso in the current directory (./) and run it. When you run the script from a launcher, it is extremely unlikely that the current directory is the one where the script resides.

This for the "why".

Some options:

  • In your script, first change to the directory where the executable remains to solve this issue.
  • Alternatively, have the .desktop launcher change the current directory to that where the executable resides with a Path= entry.
  • Alternatively, provide the absolute path to the executable poweriso in your script, and also indicate that directory in the environmental variables you create so it can find its resources.

By the way, there is no need to unset variables in your script. Once the script is finished, also the custom environment set during execution of the script is gone.

treyiii avatar
ph flag
Thank you. cd in script worked without any help. I tried other options yesterday they did not work in this situation. That was so easy, like i said before stuck on stupid.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.