[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 365
  • Last Modified:

execute script from desktop

i have an script file a.sh
i can run it in the console from it's folder with ./a.sh
how do i make it run from my (kde) desktop ? if i click it it says "Cannot find program 'a.sh' !"

1 Solution
Hi hapciu,
check the mode for the file:
ls -la a.sh
what does it say ?
in the kde control center or an menu on your panel, there is a Item called "Add application" (or alike)
there you need to choce an application type and specify the full path to your a.sh.
This presumes that a.sh is a bourne shell script and executable (mode 555 for example), other whise the command to give for the application is:
   /bin/sh /full/path/to/a.sh
Make sure that the first line of your script is:

"Cannot find program 'a.sh'" is a perennially bad error message in Unix.  It's the kernel saying that it can't find the shell script interpreter, even though it looks like it's saying that it can't find the shell script.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

>  It's the kernel saying that it can't find the shell script
it's the shell saying that it cannot find the specified program in the paths given in PATH environment variable
hapciuAuthor Commented:
da99rmd : it doesn't work even if i set permissions to full: chmod 777 a.sh

NovaDenizen : the first line of my script is #!/bin/bash . is that a problem ? if it can't find the interpreter than why does it work from the console ?

ahoffmann: I don't want to make it work only for my computer (relative to my loaction of a.sh).

The thing is that I have a java application. To run it i made a very simple script that starts the java virtual machine and loads my app. I would like to distribute the script along with the application so the users can just run the script to start the app. it works from the console, but I would like it to work from the dektop also.

thank you for your answers
> ahoffmann: I don't want to make it work only for my computer (relative to my loaction of a.sh).
what does this mean?
my suggestion uses full paths, if it shuld work on other computers you need something common (like the path, or the PATH, HOME, etc. environment variables)
If the script works from the console, then the #! line is not the problem.  

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now