I spend a lot of time downloading things that I am going to execute, without a doubt, after having downloaded them. Out of the 900-ish files in my download folder right now, roughly a third is stuff that I did download and then execute because it's the reason I downloaded them for in the first place.
Every time though, I have to do the little tiring dance of chmod +x'ing them, which is a complete waste of time as I am not downloading them just for the fun of it. Right now I have a dozen small scripts I am going to download in the next half hour and I shudder to the thought of having to chmod them all.
What can I do to make Linux either:
- ignore the x permission altogether and just do what I tell it to do without questions and without second-guessing me, as the owner, administrator, eternal deity etc etc, of my own, personal computer?
- automatically mark downloaded files as executable if they match an ELF, shell, python, etc..
file
signature?
install
command.install
gives you a lot of flexibility; it can copy, create directories, change group & owner, change mode (i.e. make the file executable), etc. You could even make the script a function that's defined in~/.bashrc
.chmod +x *
, where the*
will match everything in the current directory/lib64/ld-linux-x86-64.so.2 /path/to/download --switches --and other args
. Similarly, if you know it's a script with a particular interpreter, you could invoke that, likepython /path/to/download.py --with --args
chmod
ing every file individually? You can use wildcards for that:chmod +x *.sh
will mark all files ending with.sh
as executable.