./example.sh not working

hello.

I’m running opensuse 11.0 and i have a problem.

if i try to run


./eval.sh

as root, i get the following message:


bash: ./eval.sh: Permission denied

if i try with su -l and then ./eval.sh

i get:


-bash: ./eval.sh: No such file or directory

eval.sh exists in that folder.

Thanks, Pripoae Toni

chmod +x eval.sh
./eval.sh

yes it’s working,

but every script i run, i get permission denied, even a python script, and i have some scripts that run another, and so on, so i have to put this in a thousand places. Do i have to put this in something like a bash configuration file?

Thanks, Pripoae Toni

no, AFAIK Bash does not have a config option to make all your scripts executable. You have to do it manually. if you can, put all scripts in one dir and make them all executable at once. Next time you write a new script, make sure to always make it executable.

Yes, you must turn on the execute bit for every shell script you create. Just get into the habit of doing a chmod +x after you have finished creating a shell script. You only have to do it once. Alternatively, run it with sh.

The reason root couldn’t find it when you did su - is because a su - puts you in /root. And even root cannot execute a program if no execute bit is turned on. And you should not run things as root without reason. It is not recommended to bypass permissions by becoming root. The cause of the lack of permission should be fixed instead.

yes, i fixed it, eval.sh is now working :slight_smile: but in fedora 10 it was working :smiley: without chmod. Is opensuse 11.0 bash different than in fedora 10?

I seriously doubt that it worked on Fedora without an execute bit. This is one of the basic bits of Unix/Linux behaviour.

on fedora 10 it was working only as root, and the reason i’ve tried it as root was becouse it wasn’t working as normal user.

I have another problem. My wireless connection isnt’ working,( i have no linux wireless driver? ) i’m running opensuse 11.0 32 bit on a HP compaq 6715s laptop. I haven’t found on the internet any driver for this kind of laptop. I’m also running windows XP on this laptop, and i have no problems with the wireless driver.

Can you help me :smiley: ?

Thanks, Pripoae Toni

Start a separate thread about your wireless connection

Then perhaps the reason was the owner or group execute bits were on for root, but no world execute bit was on. Only way to know is to ls -l the file.

Sounds like you ought to teach yourself Unix/Linux permissions and other principles instead of poking around haphazardly. I can recommend this online book:

http://rute.2038bug.com/index.html.gz

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wholeheartedly agreed. I would be surprised with good reason if files
with the same permissions could be executed on Fedora but not suse when
using the same user (by ID… not necessarily username). Nothing is
magically executable in Unix/Linux/non-windows because it’s not safe.
The use of file extensions to determine whether a file is executable or
not is the reason you can get a random file from somebody you don’t even
know and have it infect you when you double-click on it (your own fault,
but still could be prevented). With *nix that never happens because a
downloaded file does not have the execute bit site. Files are
determined to be executable by an explicit setting… files types are
also determined by what the file is and not just by what it’s named
(don’t judge book by cover… file by name… same thing).

Anyway read up on the permissions stuff ken yap provided and chances are
you’ll see the differences and be able to avoid this in the future.

Good luck.

ken yap wrote:
> toni2007;1910886 Wrote:
>> on fedora 10 it was working only as root, and the reason i’ve tried it
>> as root was becouse it wasn’t working as normal user.
>
> Then perhaps the reason was the owner or group execute bits were on for
> root, but no world execute bit was on. Only way to know is to ls -l the
> file.
>
> Sounds like you ought to teach yourself Unix/Linux permissions and
> other principles instead of poking around haphazardly. I can recommend
> this online book:
>
> http://rute.2038bug.com/index.html.gz
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJS8/J3s42bA80+9kRAtohAJ0d83X7iHkZIj8h3xmECwBVSOsRUwCcDPn2
5WKOmshxEEHGuUXsgBKDnaA=
=IZma
-----END PGP SIGNATURE-----