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
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 08 '18 at 19:04