I'm creating bash scripts with .sh extensions, performing smiple tasks, but every new script I have to modify with chmod to run. I see that repositories I download from github/bitbucket containing scripts don't need this and can be run out of the box. How can I achieve this, so when someone download my repository can run this without running chmod x first. I'm working on MacOS Big Sur
CodePudding user response:
I you chmod x the file locally, git will see that as a change to the file, and you can push that change so that anybody else who clones the repo has the executable permissions:
chmod x script.sh
git add script.sh
git commit -m'make script.sh executable'
git push # if you are on a tracking branch
then is will be executable for everybody
I think that is how the repositories that you downloaded accomplished that.
CodePudding user response:
usually in unix, simply bash [scrip_name].sh is enough
In MacOS also, same might be enough
