Jump to content

Recommended Posts

Posted

I wrote a few shell (bash?) scripts to simplify some of my tasks in my Kali and Ubuntu Live discs. These were saved as .sh files that could be run when I double-clicked them. I am in the process of writing others for other repetitive tasks

Now that I have updated to Kali 2.0, I cannot run these by double-clicking them. Setting them to run in "Run application" returns a message that says: "unable to locate program"

I have just written a program called script.sh:

#!/bin/bash/

echo "Hello World"

And this one has the same difficulties.

They all run in terminal with "sh script.sh", but that defeats their simplicity.

The same problem happens in Kali and Ubuntu, so I don't think it is a Kali 2.0 issue, but it is the first place I noticed the issue.

Permissions are set to run as programs, and the properties tab is checked for "Allow executing file as a program."

Posted

I cannot find that preferences window you have, but I have also tried the chmod +x and some other suggested chmods like 755.

On Kali 1.something, activating the file would give me the option to open in terminal, open in editor, or just run the file. Here in 2.0 and in Ubuntu, I only have the ability to run the file.

Retrying with a new file opens without complaint in "Run Program" but does not produce a result (unless run in terminal with sh script.sh) for:

#!/bin/bash

echo 'hello world' > /root/Desktop/sript_output.txt

If run from terminal, it writes the file as expected, but not in "Run Program" or any other way I can think to "Execute file as program"

Posted (edited)

If you can't chmod +x form the console on the file, you could always try the forceful way(if root) of:



bash ./file.sh

which also works when the files are not executable.

Example:

​

​bash.PNG

​Oh, and try changing #!/bin/bash to #!/bin/sh

Edited by digip
Posted

I attempted the change to #!/bin/sh and everything still runs fine in terminal, but still no luck running them from the file

I would like the functionality I had previously, which is just clicking them to make them run.

Is there another way to open them that I am missing?

The permissions are set correctly

The files work if I use them in terminal

And I try opening them in "Run Software" - I couldn't find any other way to get it to stop opening in gedit or vim

I still get the same message, "Oops! There was a problem running this program. Unable to locate program", even though it is trying to load the one I just right-clicked and told to run.

Posted

The menu in my screenshot is when you open the file viewer and go into the preferences.

Totally missed that, just found it, and it worked a treat -

​http://www.ticktockcomputers.com/images/preferences.png

Had to right click the files icon form the top bar > then behavior > ask

Posted

Figured it would test the powers of observation with the settings titled "Files Preferences", with the "Files" menu at the top there. Also the blue dots next to the file browser on the Gnome panel on the left :D.

Posted (edited)

Wow, it works now, thank you. I had not gone to the top dropdown for "Files Preferences" (I did not realize that actually had more than a list of open folders) and could only find "Properties" in the window itself.

Now everything runs correctly

Edited by cupsdigress

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...