I have some Python scripts, that I keep in a repository; they are plain-text files, but if their executable bit is set, then the online repository page serves them as binary downloads, not as plain text pages. Thus, I'd prefer to keep these scripts non-executable.
However, I'd also like to use them, as well. In principle, I could do:
sudo ln -s /path/to/wherever/I/have/put/myscript.py /usr/bin/
... and then, if the script was executable (and has a shebang), I could just call on the command line:
... which is what I'd want. But if I make the script itself executable, then I have the repository download problem as stated above. And, as long as the script is non-executable, I'd have to call it with an extra
python - and a
which ( cause otherwise
python would just look in the current directory for the file):
python `which myscript.py` [ARGS]
... which is still quite a bit of typing, which I don't like. Also, as long-as the file is non-executable, not even tab completion will work for
my[TAB] even if it is in
which will work.
Now, crudely - if I could have a separate, executable permissions on the symlink, I could hope to keep the original non-executable, and still be able to run directly via just
myscript.py on the command line. I'm not sure if there is possibility for Mac OSX - but as How do file permissions apply to symlinks? - Super User notes, Linux definitely doesn't offer options for that: only the original file permissions are taken into account, the permission of the symlink itself isn't.
So I was wondering:
- Is it possible to use a different type of link (maybe "hard link"?) for that kind of purpose?
- Is there some kind of driver or software, which would basically allow you to make something akin to a symlink, but would be an identical copy of the source - except with its own set of permissions?