r/linux4noobs • • 21d ago

shells and scripting unable to open .sh file

I'm currently trying to install a program using a .sh file on linux nobara, I have tried to make it an executable, but I can only seem to open the raw code and not the program itself. It does have the permissions to be executed and run as a program, but I'm hitting a wall with my trouble shooting.

If I run it as an executable, nothing happens.

If I open with Kate, I get the raw code.

If I run in console I get the message "fatal error: no prefixes found. Run the game once and then try again."

Any ideas on how to make it work?

Edit for the first few lines:

cd "$(dirname "$0")"

STEAM_PATHS=(

"$HOME/.steam/steam"

"$HOME/.local/share/Steam"

"$HOME/snap/steam/common/.local/share/Steam"

"$HOME/steam/root"

"$HOME/steam"

"$HOME/.var/app/com.valvesoftware.Steam/.steam/steam"

"$HOME/.var/app/com.valvesoftware.Steam/.local/share/Steam"

"$HOME/.var/app/com.valvesoftware.Steam/.steam/root"

"$HOME/.var/app/com.valvesoftware.Steam/.steam"

)

LUTRIS_PATH="$HOME/Games"

BOTTLES_PATHS=(

"$HOME/.var/app/com.usebottles.bottles/data/bottles/bottles"

"$HOME/.local/share/bottles"

0 Upvotes

33 comments sorted by

15

u/fox_in_unix_socks 21d ago

Sounds like the script is running but throwing an error. Can't really advise much further without knowing what the script is supposed to be doing.

0

u/Fuckthatfuckingshit 21d ago

this is the infamous ea dlc unlocker by anadius, I'm just trying to play my sims without feeding ea.
I did add the first few lines of the code into the original post

4

u/Classic-Rate-5104 21d ago

Show us at least the first lines of the script, and the permissions

1

u/Fuckthatfuckingshit 21d ago

have added it into the original post

2

u/Unique_Low_1077 Arch btw 21d ago

Show us the raw code and we might be able to help

1

u/Fuckthatfuckingshit 21d ago

added the first few lines into the original post

1

u/Unique_Low_1077 Arch btw 15d ago

Do you mind sharing the full file?

9

u/anciant_system 21d ago

The script is looking for a wine/proton prefix, so start the game through your usual software then start the script, and it should be good

1

u/MaurokNC 21d ago

Try entering the file name as ./name.sh

1

u/Fuckthatfuckingshit 21d ago

have tried that, but same result

3

u/SlimmySlabby 21d ago

The error OP gave was not a terminal error, it’s an error from the actual script so it is executing properly, it’s just failing

1

u/urjuhh 21d ago

Try from terminal: file yourfile.sh

What does it say ?

1

u/Fuckthatfuckingshit 21d ago

same result as before, I had tried that before posting

2

u/urjuhh 21d ago

"file" as a command... It's a program that identifies what type of file you are dealing with.

-2

u/Fuckthatfuckingshit 21d ago

I get the following error:
cannot open `file.sh' (No such file or directory)

1

u/urjuhh 21d ago

Your file needs to be in same directory, or provide the full path to the file..

file /my/directory/with/the/whateverthefilenameis.sh

Ofc use actual path...

Or relative path:

file ./sub-directory/with/the/yourfile.sh

1

u/Fuckthatfuckingshit 21d ago

I opened the console to the exact path of the file

1

u/urjuhh 21d ago

But the message was "No such file or directory" meaning it could not find the file...

1

u/Fuckthatfuckingshit 21d ago

I am just as confused as you are

2

u/urjuhh 21d ago

In what directory is your file and what is its name ?

1

u/GuestStarr 21d ago

No . in the path?

1

u/Quietus87 21d ago

At least tell us what script you are trying to run and why are you fumbling with a script at all. Most applications are available in some repository or as flatpak.

1

u/Fuckthatfuckingshit 21d ago

this is for my sims dlc unlocker, so no chance that's available another way

1

u/RAMChYLD 21d ago edited 21d ago

Did you start your file with a

#!/bin/bash ?

That line is called the hashbang, and it’s very important as it tells your current shell that it is a shell script and optionally to switch to the indicated shell to run the script. Some python intepreted type programs even use it.

2

u/Fuckthatfuckingshit 21d ago

actually, no, how would I do that?

1

u/RAMChYLD 21d ago

Edit the file using the text editor of your choice and just add that to the top of the file.

2

u/Fuckthatfuckingshit 21d ago

didn't work, and I saw, that I apparently just ignored that it was already in the file since it was greyed

0

u/don_bski 21d ago

Try adding the -x option when staring the script. This tells bash to echo each script line to the console for debug purposes. See https://stackoverflow.com/questions/951336/how-can-i-debug-a-bash-script for more.

1

u/Fuckthatfuckingshit 21d ago

Added it right here but nothing in the behavior changed:

#!/usr/bin/env bash
-x
cd "$(dirname "$0")"
STEAM_PATHS=(

1

u/don_bski 20d ago

First line syntax: #!/usr/bin/bash -x

0

u/[deleted] 21d ago

[deleted] — view deleted comment

1

u/Fuckthatfuckingshit 21d ago

yes, I do trust the program and have used it on countless occasions, just can't remember how I first got it to work on fedora