How do I use chmod to make .sh files executable? [duplicate]
This question already has an answer here:
How to create & execute a script file [duplicate]
1 answer
My touch overlay is failing to respond in portrait but in landscape I got to a page where I am able to rotate touch input so that it can work in portrait (using this advice on Ubuntu Forums), so I have to make the .sh
scripts and run them. I am working with shell scripts for the first time and I am using the ones on this page and it asked me not to forget to set chmod
to execute for .sh
files using this code:
chmod 777 *.sh
16.04 scripts chmod
marked as duplicate by Kulfy, Zanna, Charles Green, Elder Geek, guntbert Dec 20 at 22:11
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to create & execute a script file [duplicate]
1 answer
My touch overlay is failing to respond in portrait but in landscape I got to a page where I am able to rotate touch input so that it can work in portrait (using this advice on Ubuntu Forums), so I have to make the .sh
scripts and run them. I am working with shell scripts for the first time and I am using the ones on this page and it asked me not to forget to set chmod
to execute for .sh
files using this code:
chmod 777 *.sh
16.04 scripts chmod
marked as duplicate by Kulfy, Zanna, Charles Green, Elder Geek, guntbert Dec 20 at 22:11
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2
Please don't use777
, use755
or justchmod a+x
instead. That said, what is your question? Do you need help running that command? Do you know how to open a terminal? Please edit your question and explain what part of this is giving you trouble.
– terdon♦
Nov 8 at 19:04
Also, * is a wildcard which means if you use *.sh, all files with extension as sh in current folder will be effected.
– Kulfy
Nov 8 at 19:09
add a comment |
This question already has an answer here:
How to create & execute a script file [duplicate]
1 answer
My touch overlay is failing to respond in portrait but in landscape I got to a page where I am able to rotate touch input so that it can work in portrait (using this advice on Ubuntu Forums), so I have to make the .sh
scripts and run them. I am working with shell scripts for the first time and I am using the ones on this page and it asked me not to forget to set chmod
to execute for .sh
files using this code:
chmod 777 *.sh
16.04 scripts chmod
This question already has an answer here:
How to create & execute a script file [duplicate]
1 answer
My touch overlay is failing to respond in portrait but in landscape I got to a page where I am able to rotate touch input so that it can work in portrait (using this advice on Ubuntu Forums), so I have to make the .sh
scripts and run them. I am working with shell scripts for the first time and I am using the ones on this page and it asked me not to forget to set chmod
to execute for .sh
files using this code:
chmod 777 *.sh
This question already has an answer here:
How to create & execute a script file [duplicate]
1 answer
16.04 scripts chmod
16.04 scripts chmod
edited Dec 20 at 10:57
Zanna
50k13131238
50k13131238
asked Nov 8 at 18:45
Kayz5ive
95
95
marked as duplicate by Kulfy, Zanna, Charles Green, Elder Geek, guntbert Dec 20 at 22:11
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Kulfy, Zanna, Charles Green, Elder Geek, guntbert Dec 20 at 22:11
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2
Please don't use777
, use755
or justchmod a+x
instead. That said, what is your question? Do you need help running that command? Do you know how to open a terminal? Please edit your question and explain what part of this is giving you trouble.
– terdon♦
Nov 8 at 19:04
Also, * is a wildcard which means if you use *.sh, all files with extension as sh in current folder will be effected.
– Kulfy
Nov 8 at 19:09
add a comment |
2
Please don't use777
, use755
or justchmod a+x
instead. That said, what is your question? Do you need help running that command? Do you know how to open a terminal? Please edit your question and explain what part of this is giving you trouble.
– terdon♦
Nov 8 at 19:04
Also, * is a wildcard which means if you use *.sh, all files with extension as sh in current folder will be effected.
– Kulfy
Nov 8 at 19:09
2
2
Please don't use
777
, use 755
or just chmod a+x
instead. That said, what is your question? Do you need help running that command? Do you know how to open a terminal? Please edit your question and explain what part of this is giving you trouble.– terdon♦
Nov 8 at 19:04
Please don't use
777
, use 755
or just chmod a+x
instead. That said, what is your question? Do you need help running that command? Do you know how to open a terminal? Please edit your question and explain what part of this is giving you trouble.– terdon♦
Nov 8 at 19:04
Also, * is a wildcard which means if you use *.sh, all files with extension as sh in current folder will be effected.
– Kulfy
Nov 8 at 19:09
Also, * is a wildcard which means if you use *.sh, all files with extension as sh in current folder will be effected.
– Kulfy
Nov 8 at 19:09
add a comment |
3 Answers
3
active
oldest
votes
- Easy way in Kubuntu (Ubuntu is the same). Properties of sh file that you need to change.
Just open a terminal and go into the folder where you handle the
.sh
file (like mine below), and runchmod a+x foo.sh
wherefoo.sh
is the name of the script.
cd /path/to/script/directory
chmod a+x foo.sh
add a comment |
The way question sounds is "How do I automate making .sh files ( or scripts in general ) executable?" And the answer is that you can't without changing the default permissions for newly created files. That's done via umask. The .sh files aren't special, they're just text files at very basic level. But of course you don't want to change umask to give executable permission to any random text file that's been just created, because you're opening a Pandora's box of security holes for yourself.
So the answer is you can't automate that without unreasonable security hole. Better approach is just to get into habits of running chmod yourself or running scripts as argument to appropriate interpreter such as bash foo.sh
. Or make a shell function to call your favorite text editor to create a file and then chmod, for instance
makesh(){
for i; do
vi "$i"
chmod +x "$i"
done
}
I know this answer isn't pretty of fun, but it's practical
add a comment |
Navigate to the folder where the file is using cd.
Run the following command:
chmod a+x FILENAME.sh
Hope that helps.
1
This seems to be a duplicate answer.
– Kulfy
Nov 8 at 19:10
The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
– Qumber Rizvi
Nov 8 at 19:13
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
- Easy way in Kubuntu (Ubuntu is the same). Properties of sh file that you need to change.
Just open a terminal and go into the folder where you handle the
.sh
file (like mine below), and runchmod a+x foo.sh
wherefoo.sh
is the name of the script.
cd /path/to/script/directory
chmod a+x foo.sh
add a comment |
- Easy way in Kubuntu (Ubuntu is the same). Properties of sh file that you need to change.
Just open a terminal and go into the folder where you handle the
.sh
file (like mine below), and runchmod a+x foo.sh
wherefoo.sh
is the name of the script.
cd /path/to/script/directory
chmod a+x foo.sh
add a comment |
- Easy way in Kubuntu (Ubuntu is the same). Properties of sh file that you need to change.
Just open a terminal and go into the folder where you handle the
.sh
file (like mine below), and runchmod a+x foo.sh
wherefoo.sh
is the name of the script.
cd /path/to/script/directory
chmod a+x foo.sh
- Easy way in Kubuntu (Ubuntu is the same). Properties of sh file that you need to change.
Just open a terminal and go into the folder where you handle the
.sh
file (like mine below), and runchmod a+x foo.sh
wherefoo.sh
is the name of the script.
cd /path/to/script/directory
chmod a+x foo.sh
edited Nov 8 at 19:03
terdon♦
64.2k12136212
64.2k12136212
answered Nov 8 at 18:56
peanek
212
212
add a comment |
add a comment |
The way question sounds is "How do I automate making .sh files ( or scripts in general ) executable?" And the answer is that you can't without changing the default permissions for newly created files. That's done via umask. The .sh files aren't special, they're just text files at very basic level. But of course you don't want to change umask to give executable permission to any random text file that's been just created, because you're opening a Pandora's box of security holes for yourself.
So the answer is you can't automate that without unreasonable security hole. Better approach is just to get into habits of running chmod yourself or running scripts as argument to appropriate interpreter such as bash foo.sh
. Or make a shell function to call your favorite text editor to create a file and then chmod, for instance
makesh(){
for i; do
vi "$i"
chmod +x "$i"
done
}
I know this answer isn't pretty of fun, but it's practical
add a comment |
The way question sounds is "How do I automate making .sh files ( or scripts in general ) executable?" And the answer is that you can't without changing the default permissions for newly created files. That's done via umask. The .sh files aren't special, they're just text files at very basic level. But of course you don't want to change umask to give executable permission to any random text file that's been just created, because you're opening a Pandora's box of security holes for yourself.
So the answer is you can't automate that without unreasonable security hole. Better approach is just to get into habits of running chmod yourself or running scripts as argument to appropriate interpreter such as bash foo.sh
. Or make a shell function to call your favorite text editor to create a file and then chmod, for instance
makesh(){
for i; do
vi "$i"
chmod +x "$i"
done
}
I know this answer isn't pretty of fun, but it's practical
add a comment |
The way question sounds is "How do I automate making .sh files ( or scripts in general ) executable?" And the answer is that you can't without changing the default permissions for newly created files. That's done via umask. The .sh files aren't special, they're just text files at very basic level. But of course you don't want to change umask to give executable permission to any random text file that's been just created, because you're opening a Pandora's box of security holes for yourself.
So the answer is you can't automate that without unreasonable security hole. Better approach is just to get into habits of running chmod yourself or running scripts as argument to appropriate interpreter such as bash foo.sh
. Or make a shell function to call your favorite text editor to create a file and then chmod, for instance
makesh(){
for i; do
vi "$i"
chmod +x "$i"
done
}
I know this answer isn't pretty of fun, but it's practical
The way question sounds is "How do I automate making .sh files ( or scripts in general ) executable?" And the answer is that you can't without changing the default permissions for newly created files. That's done via umask. The .sh files aren't special, they're just text files at very basic level. But of course you don't want to change umask to give executable permission to any random text file that's been just created, because you're opening a Pandora's box of security holes for yourself.
So the answer is you can't automate that without unreasonable security hole. Better approach is just to get into habits of running chmod yourself or running scripts as argument to appropriate interpreter such as bash foo.sh
. Or make a shell function to call your favorite text editor to create a file and then chmod, for instance
makesh(){
for i; do
vi "$i"
chmod +x "$i"
done
}
I know this answer isn't pretty of fun, but it's practical
edited Nov 8 at 19:28
answered Nov 8 at 19:22
Sergiy Kolodyazhnyy
69.3k9144304
69.3k9144304
add a comment |
add a comment |
Navigate to the folder where the file is using cd.
Run the following command:
chmod a+x FILENAME.sh
Hope that helps.
1
This seems to be a duplicate answer.
– Kulfy
Nov 8 at 19:10
The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
– Qumber Rizvi
Nov 8 at 19:13
add a comment |
Navigate to the folder where the file is using cd.
Run the following command:
chmod a+x FILENAME.sh
Hope that helps.
1
This seems to be a duplicate answer.
– Kulfy
Nov 8 at 19:10
The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
– Qumber Rizvi
Nov 8 at 19:13
add a comment |
Navigate to the folder where the file is using cd.
Run the following command:
chmod a+x FILENAME.sh
Hope that helps.
Navigate to the folder where the file is using cd.
Run the following command:
chmod a+x FILENAME.sh
Hope that helps.
answered Nov 8 at 19:06
Qumber Rizvi
13
13
1
This seems to be a duplicate answer.
– Kulfy
Nov 8 at 19:10
The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
– Qumber Rizvi
Nov 8 at 19:13
add a comment |
1
This seems to be a duplicate answer.
– Kulfy
Nov 8 at 19:10
The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
– Qumber Rizvi
Nov 8 at 19:13
1
1
This seems to be a duplicate answer.
– Kulfy
Nov 8 at 19:10
This seems to be a duplicate answer.
– Kulfy
Nov 8 at 19:10
The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
– Qumber Rizvi
Nov 8 at 19:13
The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
– Qumber Rizvi
Nov 8 at 19:13
add a comment |
2
Please don't use
777
, use755
or justchmod a+x
instead. That said, what is your question? Do you need help running that command? Do you know how to open a terminal? Please edit your question and explain what part of this is giving you trouble.– terdon♦
Nov 8 at 19:04
Also, * is a wildcard which means if you use *.sh, all files with extension as sh in current folder will be effected.
– Kulfy
Nov 8 at 19:09