You are not logged in.

#1 2009-07-27 00:26:36

svanberg
Member
Registered: 2009-07-16
Posts: 88

[Solved] Making a script executable

How do i make a script executable without adding the script to the PATH variable?

I have read in some articles that the only need for creating executable script is to use this:

chmod -x script.sh

But when im running like normal user with:

./script.sh

I get this:

bash: ./script.sh: Permission denied

Why?

Last edited by svanberg (2009-07-28 21:31:13)

Offline

#2 2009-07-27 00:51:18

&#32 Greg
Member
Registered: 2009-02-08
Posts: 80

Re: [Solved] Making a script executable

I'm pretty sure that it's chmod +x, not chmod -x.

Offline

#3 2009-07-27 01:10:44

arkham
Member
From: Stockholm
Registered: 2008-10-26
Posts: 516
Website

Re: [Solved] Making a script executable

You're actually removing the executable flag.


"I'm Winston Wolfe. I solve problems."

~ Need moar games? [arch-games] ~ [aurcheck] AUR haz updates? ~

Offline

#4 2009-07-27 01:27:38

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: [Solved] Making a script executable

Previous 2 posts are correct...  "-x" means *remove* this permission, so you need to use "+x" to *add* this permission to the file.

`ls -l` will show you the permissions of the file after you've changed it to ensure you've got it right.

Offline

#5 2009-07-27 11:40:12

fumbles
Member
Registered: 2006-12-22
Posts: 246

Re: [Solved] Making a script executable

.

Last edited by fumbles (2020-09-26 11:38:23)

Offline

#6 2009-07-27 11:45:23

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: [Solved] Making a script executable

I don't think you can set e.g. sticky bits with a number...


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#7 2009-07-27 12:17:40

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

Re: [Solved] Making a script executable

Yes you can smile

chmod 1777

Offline

#8 2009-07-27 12:21:39

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: [Solved] Making a script executable

Ok tongue


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#9 2009-07-28 21:30:30

svanberg
Member
Registered: 2009-07-16
Posts: 88

Re: [Solved] Making a script executable

Okay, my fault. Thanks for your help.

chmod +x script.sh

Offline

Board footer

Powered by FluxBB