0

I'm just starting on Ubuntu, trying to figure things out. I'm a little confused.

Short version of my questions:

A) Making my bash scripts executable doesn't seem to be working reliably. It just inexplicably won't work sometimes, even when using the same steps on identical scripts in the same directory.

B) When I can get the executability to work, sometimes two identical scripts seem to behave differently. One does its job as intended, the other throws a "Command not found" Error notification, despite both being the same scripts with different names in the same directory.

------(More details)--------

My steps for making scripts executable:

  1. Right click on the file and check Properties>Permissions>"Allow executing files as program." (This doesn't seem to do anything, but I do it anyway. Whenever I try to execute the script after this step, nothing happens.)

  2. Run "chmod +x " in the terminal.

I have got this to work on two different scripts, but on no others. I have no idea what I'm doing wrong. When executability isn't working, I can run the script through the terminal, and it works just fine.

Here's an example of the script I'm trying to run:

#!/bin/bash

cd Desktop/Projects/Zemmings\ V3/NeoLemmix_V12.12.1
wine NeoLemmix.exe

This script works, and is executable. Now I want to duplicate it and change the paths and programs for different windows apps.

I copy and paste the file, change the name, run through the executability steps above, double click it, and I get an error saying "Command not found". However, this is before changing the script, so it should do exactly the same thing as the original. Despite having identical contents, it give an error while the original still works.

So, if anyone has an answer or tip for me, let me know.

-------(Summary of questions)------------

Why does checking Properties>Permissions>"Allow executing files as program." on a file seem to do nothing?

Why doesn't "chmod +x " work sometimes?

Why are two identical scripts in the same directory behaving differently?

Thanks!

7
  • Executability is correctly set, as terminal works fine, so something different is wrong. This seems to only be about running a script from a file manager. Which one, and also which type of Ubuntu and version are you using? Also, if the only difference really is the name of the files, those exact names might be a clue. Sep 2, 2021 at 19:52
  • What's the underlying filesystem?
    – waltinator
    Sep 2, 2021 at 20:53
  • Is your editor saving the file with Windows-style line endings? (carriage return + newline instead of just newline) Sep 3, 2021 at 1:16
  • @mook765 The goal is to launch the scripts from my desktop, not the terminal. It's a time-saving thing. It's the executability from the desktop that's not working. As for the paths, I sort of thought they were absolute. Do they just need a / at the beginning of the paths? I thought relative paths used the . and .. thingies.
    – zanzindorf
    Sep 3, 2021 at 3:41
  • @MartinThornton I think it's the default one that comes with default Ubuntu. The about window says it's name is just "Files". I'm running Ubuntu 20.04.2 LTS if that helps. I also have something called "FileManager-Actions" which has a nautilus icon. I tried duplicating the script, deleting the original, and renaming the copy what the original was named, but was met with the same error.
    – zanzindorf
    Sep 3, 2021 at 3:47

1 Answer 1

0

The issue I think is that the default desktop is just horrendous. While researching a separate issue, it seems there are numerous issues with the default desktop, and some people just recommend using a different extension for it entirely, which is what I'll do. I switched to "Desktop Icons NG" and everything works perfectly now.

I can simply check "Allow executing files as program" in permissions, and it now works without issue thanks to the new desktop extension. I can also now drag and drop files on my desktop into apps and file browsers. All is good now. Sorry this isn't a fix, it's a workaround, but I think this is simply a bug or an oversight (based on other discussions I found) which will be patched eventually. So I think the only real solution is to wait until it's fixed or use this workaround.

Another possible solution I saw was to disable the experimental view for the file browser, but that did not work for me.

To install the alt desktop extension that worked for me: https://ubuntuhandbook.org/index.php/2020/10/enable-drag-drop-desktop-ubuntu-20-04/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.