cupsdigress Posted August 25, 2015 Share Posted August 25, 2015 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." Quote Link to comment Share on other sites More sharing options...
Mr-Protocol Posted August 25, 2015 Share Posted August 25, 2015 This will make the file just run if you give it chmod +x file.sh It will not open a terminal and show stdout. It runs it in the background. The best I got for a 2 minute look. Quote Link to comment Share on other sites More sharing options...
cupsdigress Posted August 25, 2015 Author Share Posted August 25, 2015 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/bashecho '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" Quote Link to comment Share on other sites More sharing options...
digip Posted August 25, 2015 Share Posted August 25, 2015 (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: ​ ​ ​Oh, and try changing #!/bin/bash to #!/bin/sh Edited August 25, 2015 by digip Quote Link to comment Share on other sites More sharing options...
cupsdigress Posted August 25, 2015 Author Share Posted August 25, 2015 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. Quote Link to comment Share on other sites More sharing options...
Mr-Protocol Posted August 25, 2015 Share Posted August 25, 2015 The menu in my screenshot is when you open the file viewer and go into the preferences. Quote Link to comment Share on other sites More sharing options...
digip Posted August 25, 2015 Share Posted August 25, 2015 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 Quote Link to comment Share on other sites More sharing options...
Mr-Protocol Posted August 25, 2015 Share Posted August 25, 2015 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. Quote Link to comment Share on other sites More sharing options...
cupsdigress Posted August 26, 2015 Author Share Posted August 26, 2015 (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 August 26, 2015 by cupsdigress Quote Link to comment Share on other sites More sharing options...
deadlyhabit Posted August 26, 2015 Share Posted August 26, 2015 if you don't want to drop it in your /bin/ you can always do a link between where it is and your command using the ln command like in kali 2.0 i installed the modded mdk3 https://github.com/soxrok2212/mdk3-master and didn't uninstall the default mdk3 just created a link to the new modded version for my mdk3 command like ln /root/mdk3-master/mdk3 mdk3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.