Ash file.sh not found errors when running scripts

trying to run scripts and I’m getting

root@GL-SFT1200:~/surfshark-wireguard# gen_wg_config.sh
-ash: gen_wg_config.sh: not found
root@GL-SFT1200:~/surfshark-wireguard# gen_wg_config.bash
-ash: gen_wg_config.bash: not found

As written here: Speedtest from Router - #14 by LupusE

Please try ./ before the command.
./speedtest

I have no access to my Beryl, right now. Else I would have test ist myself, before recommending.

Explaination:
If you type any command in a linux shell, the filename will be searched in the directories, mentioned in the $PATH variable …
echo $PATH should give something like:

/usr/local/bin:/usr/bin:/bin

but as /root/ is not in $PATH, the command cannot be found. So you’ll tell the shell with ./ ‘execute this file here, from this path.’

And in addition the root directory is /. The path /root will be called ‘home directory of the root user’. A little unlucky, that the path root and the user root is the same word, but isn’t the same meaning.

1 Like

Also check that the program has the Unix Execute permission. If not, then set the permission:

chmod +x ./(program file name)
2 Likes

Have you tried the suggestions?

suggestions worked to run the speedtest app but apparently it’s arm based and won’t run with mips cpu

The situation was another in the linked topic.
You don’t try to execute a compiled binary, you’re about to start a shellscript. But the solution could be the same in both questions → write ./ before the command.
The architecture (arm, mips, …) should play a lower role in a shell script, than in a binary.

As an alternative you can try bash [name_of_the_script].sh or ash [name_of_the_skript].sh

But from your response, I’m not sure if the file will be available. Please check with ls ~/surfshark-wireguard, if the desired file is in the actual directory, before try to execute it.

The Execute permission is required to directly run both compiled programs and shell scripts.

If the current directory is not included in the PATH variable, a preceding ./ is required to run both compiled programs and shell scripts.

Shell scripts may also run programs compiled for a specific architecture.