Forum › Forums › New users › New Users and General Questions › Can’t run most .sh bash scripts from spaceFM
- This topic has 27 replies, 4 voices, and was last updated Sep 14-9:10 pm by PenguinGuy.
-
AuthorPosts
-
September 11, 2021 at 8:12 pm #66946Member
PenguinGuy
::Command -v says the folder is ‘usr/bin/’
Sadly none of these work, there’s a bunch of link aliases, but they all link back to ‘/usr/lib/nvidia/current’. I also tried to source or direct path this folder, but still the same not found errors.
They all work in the Terminal though & can be executed through the UI.
——————————–
Anyways, I can’t get spacefm or zzzfm to open from a .sh either, but can from a terminal. They both also say the command is ‘usr/bin/’
Maybe if I can figure out these that would solve my other issues.
- This reply was modified 1 year, 8 months ago by PenguinGuy.
September 12, 2021 at 5:28 am #66963Member
sybok
::Anyways, I can’t get spacefm or zzzfm to open from a .sh either, but can from a terminal.
Strange, I made a simple script ‘test.sh’
#!/bin/bash spacefm &and I run it as follows ‘bash test.sh’ open ‘spacefm’; also works if I remove the ‘&’ after ‘spacefm’.
The same happens if I make the file executable (via ‘chmod u+x’) and run it simply as ‘./test.sh’.I.e. I can open spacefm from a BASH script run from a terminal.
- This reply was modified 1 year, 8 months ago by sybok. Reason: Fix closing tag
- This reply was modified 1 year, 8 months ago by sybok.
September 12, 2021 at 9:46 am #66973Member
Xecure
::I can’t get spacefm or zzzfm to open from a .sh either,
Can you confirm the same behavior when running on your home folder as you experience from a separate partition/external-media?
If the scripts fail from both (try sybok’s echo “Hello!” script, as it is simple, to “Run in Terminal”, adding a read command at the bottom to keep it open), you will have to describe to us if you changed the login manager, or the system’s PATH variable (loaded from .bashrc or from the general files /etc/profile or /etc/environment).
Simple scripts with commands stored in /sbin or /usr/bin or /usr/share/bin should work properly from any place.
- This reply was modified 1 year, 8 months ago by Xecure.
antiX Live system enthusiast.
General Live Boot Parameters for antiX.September 12, 2021 at 4:11 pm #66994Member
PenguinGuy
::I can’t get spacefm or zzzfm to open from a .sh either,
Can you confirm the same behavior when running on your home folder as you experience from a separate partition/external-media?
If the scripts fail from both (try sybok’s echo “Hello!” script, as it is simple, to “Run in Terminal”, adding a read command at the bottom to keep it open), you will have to describe to us if you changed the login manager, or the system’s PATH variable (loaded from .bashrc or from the general files /etc/profile or /etc/environment).
Simple scripts with commands stored in /sbin or /usr/bin or /usr/share/bin should work properly from any place.
I just get a dialog that says:
The new terminal's command failed to run: Failed to execute child process “/home/Ransilon/Desktop/__spacefm.sh” (No such file or directory)It doesn’t matter where I copy it to.
I seem to get this dialog whenever there is a ‘#!bin/bash’ & it fails.
If I remove the ‘#!bin/bash’ & it fails I get in the Terminal:
notfoundlon/Desktop/__spacefm.sh: 1: /home/Ransilon/Desktop/__spacefm.sh: Press any key to continueNote, I can just use this to open VS Code (no ‘#!bin/bash’ needed):
code --disable-gpu========================================
Just figured out through trial & error I can launch spacefm from a .sh just with (‘#!bin/bash’ if added will break it with the dialog error above):
spacefm --name=NAME read -p "Press any key to continue" xKind of weird that I am forced to specify certain options, but code (VS Code) has the same issue.
Maybe this is a 5.10 kernel issue?
========================================
UPDATE: I can also run nvidia-settings with the option:
nvidia-settings --config=CONFIG read -p "Press any key to continue" xA lot of options don’t work for opening with .sh — ultra-hackish but this works for now.
Has anyone used the 5.10 kernel to test if this is an issue there?
BTW, ‘notfoundlon‘ is not a typo. I’ve noticed similar failures have ‘not foundia‘ & other misspellings (based on the app name) like some sort of C buffer or array overwrite. Maybe 5.10/runit or whatever is corrupted & doesn’t work 100%?
- This reply was modified 1 year, 8 months ago by PenguinGuy.
- This reply was modified 1 year, 8 months ago by PenguinGuy.
- This reply was modified 1 year, 8 months ago by PenguinGuy.
September 13, 2021 at 6:44 am #67049Member
sybok
::Hi,
it seems to me that you are expressing your issues in an incomplete/confusing way.
Since you have mentioned ‘__spacefm.sh’ located in your/some home directory, I guess that what you actually wanted to say byAnyways, I can’t get spacefm or zzzfm to open from a .sh either, but can from a terminal. They both also say the command is ‘usr/bin/’
was
“I can’t get some custom scripts supposed to call spacefm or zzzfm to open these GUI programs from a .sh either, …“.I’ve scanned my PC for ‘__spacefm.sh’ and ‘spacefm.sh’ (‘find / -mount -iname “<one name>”‘) and none were found.
If that is true, then please, be more specific in description of your problems including mentioning any customizations you have made.
This will allow the people engaged in this topic to provide help more effectively.
If I am wrong, then please disregard this post.- This reply was modified 1 year, 8 months ago by sybok. Reason: Improved formulation
September 13, 2021 at 10:27 pm #67123Member
PenguinGuy
::Hi,
it seems to me that you are expressing your issues in an incomplete/confusing way.
Since you have mentioned ‘__spacefm.sh’ located in your/some home directory, I guess that what you actually wanted to say byAnyways, I can’t get spacefm or zzzfm to open from a .sh either, but can from a terminal. They both also say the command is ‘usr/bin/’
was
“I can’t get some custom scripts supposed to call spacefm or zzzfm to open these GUI programs from a .sh either, …“.I’ve scanned my PC for ‘__spacefm.sh’ and ‘spacefm.sh’ (‘find / -mount -iname “<one name>”‘) and none were found.
If that is true, then please, be more specific in description of your problems including mentioning any customizations you have made.
This will allow the people engaged in this topic to provide help more effectively.
If I am wrong, then please disregard this post.‘__spacefm.sh‘ is one of several test scripts (it’s called spacefm because it literally is just ‘spacefm’ with options). Most of my bash scripts I created for use in Windows (which doesn’t have an actual Linux filesystem) so they don’t need shebangs or have permission path or missing file issues. I need to convert & set them up for Linux. What are .sh used for? Bash shell commands to manipulate the filesystem & run programs with options.
So if I create __spacefm.sh with this it fails with a dialog “The new terminal’s command failed to run: Failed to execute child process “/home/Ransilon/Documents/__spacefm.sh” (No such file or directory)”:
#!bin/bash spacefm & read -p "Press any key to continue" xIf I remove the shebang like this it works:
spacefm & read -p "Press any key to continue" xHowever, the #!bin\bash shebang also works fine with nvm .shs I made earlier in this thread.
=========================================================
I can’t get spacefm or zzzfm to open from a .sh either,
Can you confirm the same behavior when running on your home folder as you experience from a separate partition/external-media?
If the scripts fail from both (try sybok’s echo “Hello!” script, as it is simple, to “Run in Terminal”, adding a read command at the bottom to keep it open), you will have to describe to us if you changed the login manager, or the system’s PATH variable (loaded from .bashrc or from the general files /etc/profile or /etc/environment).
Simple scripts with commands stored in /sbin or /usr/bin or /usr/share/bin should work properly from any place.
I’m not sure what you mean. On actual /home I have no access to create or move files. On home/Ransilon I can copy & move files & have tested so on the desktop & documents, it works the same.
- This reply was modified 1 year, 8 months ago by PenguinGuy.
- This reply was modified 1 year, 7 months ago by PenguinGuy.
- This reply was modified 1 year, 7 months ago by PenguinGuy.
September 14, 2021 at 9:33 am #67157Member
Xecure
::I’m not sure what you mean. On actual /home I have no access to create or move files.
Sorry. I meant in your user’s folders in /home and not a different partition.
So if I create __spacefm.sh with this it fails with a dialog “The new terminal’s command failed to run: Failed to execute child process “/home/Ransilon/Documents/__spacefm.sh” (No such file or directory)”:
#!bin\bash spacefm & read -p "Press any key to continue" xThe shebang should be
#!/bin/bash
Windows uses “\” for paths. Linux uses “/” for paths.
anyways, that is not important.A script without a shebang will launch, even if not set with executing permissions, using the command bash.
I created the script following your script just to test.script1:
#!/bin/bash spacefm & read -p "Press any key to continue" xTest 1A. Running it without execute permissions with bash.
Results 1A: no problems running (spacefm launches and the terminal waits for my input$ bash script1 Press any key to continueTest 1B. Running it without permissions from terminal.
Results 1B: doesn’t run (no permissions)$ ./script1 bash: ./script1: Permission deniedTest 1C. Giving the script executable permissions and running in terminal
Results 1C: After giving the file executable permissions, it runs in terminal without the need to use the bash command (optional).$ chmod +x script1 && ./script1 Press any key to continueTest 1D. script1 has executable permissions. Click to run in terminal from spacefm.
Results 1D: The terminal opens and runs the script.

script2: (no shebang, not executable)
spacefm & read -p "Press any key to continue" xTest 2A. Running in terminal with bash.
Results 2A: no problems running (spacefm launches and the terminal waits for my input$ bash script2 Press any key to continueTest 2B. Running it without permissions from terminal.
Results 2B: doesn’t run (no permissions)$ ./script2 bash: ./script2: Permission deniedTest 2C. Giving the script executable permissions and running in terminal
Results 2C: After giving the file executable permissions (surprisingly), it runs in terminal without the need to use the bash command (I didn’t expect this).chmod +x script2 && ./script2 Press any key to continueTest 2D. script2 has executable permissions. Click to execute (it isn’t recognized as a mimetype shellscript, so it will not have the “Run in Terminal” option).
Results 2D: The script runs and spacefm is launched!

The surprise, after my tests, is that the script doesn’t need the shebang to run from spacefm or terminal.
I hope this illustrates what happens on most systems. If it doesn’t happen in yours it is possible that you have a different export PATH configuration in ~/.bashrc (and not the default in antiX), or that you are using a different method to start the gui session (maybe lightdm doesn’t load the same binary paths as slim).
Please provide a bit more info on your system and if you changed anything there.
antiX Live system enthusiast.
General Live Boot Parameters for antiX.September 14, 2021 at 2:49 pm #67194Member
PenguinGuy
::#!bin\bash spacefm & read -p "Press any key to continue" xThe shebang should be
#!/bin/bash
Windows uses “\” for paths. Linux uses “/” for paths.
anyways, that is not important.The ‘\‘ was a post typo.
Works without shebang, but still has ‘file not found‘ in console:
.bashrc: https://pastebin.com/im3cYTjK
==============================================================
After some more research I found that it might be the filesystem: https://stackoverflow.com/questions/12758125/sh-0-getcwd-failed-no-such-file-or-directory-on-cited-drive?rq=1
New ‘cd‘ filesystem hack that works + allows shebang, but still has ‘file not found‘ in console:
Again, I ask — am I the only person testing this on antiX with the 5.10 kernel?
- This reply was modified 1 year, 7 months ago by PenguinGuy.
- This reply was modified 1 year, 7 months ago by PenguinGuy.
- This reply was modified 1 year, 7 months ago by PenguinGuy.
September 14, 2021 at 5:27 pm #67215Anonymous
::To date, I have not used any 5.x kernels (you asked)
That stackoverflow page you linked, it serves as a good reminder ~~ although we humans think in terms of file//directory “names”, the filesystem and shell interpreter (and other “stuffs”) often rely on “inode” references instead.
BTW, ‘notfoundlon‘ is not a typo. I’ve noticed similar failures have ‘not foundia‘ & other misspellings (based on the app name) like some sort of C buffer or array overwrite. Maybe 5.10/runit or whatever is corrupted & doesn’t work 100%?
Above, you reported that the truncation was not observed when the script(s) were run via terminal. That detail suggests we can ruleout “kernel”, “runit”, and “bash”…
> Failed to execute child process “/home/Ransilon/Desktop/__spacefm.sh” (No such file or directory)
…and that we should suspect the problem stems from a bug within the spacefm’s dialog-related or script handling -related code.
Generically, toward avoiding the “notfound” outcome, the following may serve as a more robust hashbang string:
#!/usr/bin/env bash
September 14, 2021 at 6:26 pm #67219Member
PenguinGuy
::To date, I have not used any 5.x kernels (you asked)
That stackoverflow page you linked, it serves as a good reminder ~~ although we humans think in terms of file//directory “names”, the filesystem and shell interpreter (and other “stuffs”) often rely on “inode” references instead.
BTW, ‘notfoundlon‘ is not a typo. I’ve noticed similar failures have ‘not foundia‘ & other misspellings (based on the app name) like some sort of C buffer or array overwrite. Maybe 5.10/runit or whatever is corrupted & doesn’t work 100%?
Above, you reported that the truncation was not observed when the script(s) were run via terminal. That detail suggests we can ruleout “kernel”, “runit”, and “bash”…
> Failed to execute child process “/home/Ransilon/Desktop/__spacefm.sh” (No such file or directory)
…and that we should suspect the problem stems from a bug within the spacefm’s dialog-related or script handling -related code.
The truncation DOES happen in the terminal & it’s with multiple different scripts accessing different files. The other example probably didn’t occur because the string/C array wasn’t long enough.
Here you can see an example where the file name is ‘__sudo_nvidia-settings-copy2.sh’ but it says ‘not foundo_nvidia-settings-copy2.sh’:
Generically, toward avoiding the “notfound” outcome, the following may serve as a more robust hashbang string:
BTW, I can confirm I was able to get the Terminal to print ‘not founds.sh’ instead of ‘not found __spacefmGalactusGalactusGalactusGalactusGalactusGalactusGalactusGalactus.sh’ by just renaming the file.
==========================================================================
#!/usr/bin/env bash
This fails with the non-dialog Terminal message ‘/usr/bin/env: ‘bash\r’: No such file or directory’.
If I add ‘cd .’ above, it works as if no shebang with the ‘not foundo_nvidia-settings-copy2.sh’ Terminal type messages.
- This reply was modified 1 year, 7 months ago by PenguinGuy.
- This reply was modified 1 year, 7 months ago by PenguinGuy.
- This reply was modified 1 year, 7 months ago by PenguinGuy.
September 14, 2021 at 7:03 pm #67225Member
Xecure
::My antiX 19.2 fully updated system:

Kernel 5.10.22 (not the newest as it gives me problems).Your .bashrc file is totally good.
INFO ON MY SYSTEM (which works OK with scrpst):
$ inxi -S System: Host: build-pc Kernel: 5.10.22-antix.1-amd64-smp x86_64 bits: 64 Desktop: Fluxbox 1.3.7 Distro: antiX-19.2.1_x64-base Hannie Schaft 29 March 2020These are the files in my home folder that export the PATH variable:
$ grep "PATH" ./.* 2>/dev/null ./.bashrc:# Add sbin directories to PATH. This is useful on systems that have sudo ./.bashrc:echo $PATH | grep -Eq "(^|:)/sbin(:|)" || PATH=$PATH:/sbin ./.bashrc:echo $PATH | grep -Eq "(^|:)/usr/sbin(:|)" || PATH=$PATH:/usr/sbin ./.bashrc:export PATH="$PATH:$HOME/.dotnet/tools" ./.profile:# set PATH so it includes user's private bin if it exists ./.profile: PATH="$HOME/bin:$PATH" ./.profile:# set PATH so it includes user's private bin if it exists ./.profile: PATH="$HOME/.local/bin:$PATH" ./.sbuildrc:# PATH to set when running dpkg-buildpackageFrom slim (my login manager):
$ grep -i "DEFAULT_PATH" /etc/slim.conf default_path /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/gamesFrom /etc/profile
$ grep PATH /etc/profile PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" export PATHI don’t believe there are any other files that load the PATH variable, but I am not sure if this is related to this problem anymore.
My filesystem:
$ blkid | grep -i antix19 /dev/sda6: LABEL="rootantiX19" UUID="[...]" TYPE="ext4" PARTLABEL="antiX" PARTUUID="[...]"I really cannot follow this thread anymore. I don’t understand he problem and the PATH problem I initially thought doesn’t seem to be related.
antiX Live system enthusiast.
General Live Boot Parameters for antiX.September 14, 2021 at 9:10 pm #67244Member
PenguinGuy
::My antiX 19.2 fully updated system:
Kernel 5.10.22 (not the newest as it gives me problems).
Your .bashrc file is totally good.
I don’t believe there are any other files that load the PATH variable, but I am not sure if this is related to this problem anymore.
My filesystem:
$ blkid | grep -i antix19 /dev/sda6: LABEL="rootantiX19" UUID="[...]" TYPE="ext4" PARTLABEL="antiX" PARTUUID="[...]"I really cannot follow this thread anymore. I don’t understand he problem and the PATH problem I initially thought doesn’t seem to be related.
Thanks. All I did was install the 5.10 iso from Sourceforge & then install all upgrades through the package manager — I think I’ve only been using antiX for about a week.
The only other thing I can think of is I used the Control Center Manage Disks (Disk Manager) tool to mount my drives. Mainly because I couldn’t add exec to my external drive in Spacefm (I suspect because of the same file system issue).
It’s not exactly pretty, but the ‘cd .’ filesystem hack seems to solve the issue for now.
I think at this point I probably should move my /home off of the current partition to my external drive & then maybe format/install the latest version after it exits beta.
The older kernels before 5.10 wouldn’t load up (didn’t support my SSD?) so maybe a newer kernel might help at some point too.
- This reply was modified 1 year, 7 months ago by PenguinGuy.
-
AuthorPosts
- You must be logged in to reply to this topic.



