Siduction Forum

Siduction Forum => Scripting & Kernelhacking => Topic started by: tosidornottosid on 2013/10/15, 08:03:40

Title: Scripts executable by default
Post by: tosidornottosid on 2013/10/15, 08:03:40
Hello!

How can we set every script or script-like entity
executable by default in our system?

Sometimes it is very time-consuming (and boring) to
set scripts executable one by one. I have observed that
on my Debian installation it goes like that: scripts are set executable by default.

How can we achieve this on siduction? I know it is not very
secure, but...

Thanks!
Title: RE: Scripts executable by default
Post by: dibl on 2013/10/15, 20:51:52
Excuse me for challenging the question -- I hate it if anyone does that to me -- but it seems a very unusual question.  (I have never heard it in 7 years of using Linux).

Executable by whom?

And what problem, exactly, is this trying to solve? (What script does not have execute permissions, that needs to be changed)?
Title: RE: Scripts executable by default
Post by: tosidornottosid on 2013/10/17, 01:08:53
Ok! I will give the real example in order to be precise.

I use, alongside the native linux software, a few java applications. When I install a new system, like I did a month ago with siduction, I copy these applications to the hard drive. They are standalone. Every one of them has a
shell script. I use these scripts to create the Menu entries for these applications.

So this is the issue: I had to make executable every one of them. They
where not executable by default. Sometimes, I had to search to the subfolders too. For example, in Haundrix Chess, I had to make executable not only the main program file, but also the chess engines that where inside some strange subfolder.

So I have this question because I noticed that on my Debian Sid installation, all these scripts are executable by default. That is, just by copying them to the hard drive. I don't have to go to very single one of them and make them executable. So, Debian sees them as executables by default, while siduction sees them as text files.

And I wonder if this is a general system setting, or maybe a file manager setting? I use KDE and Dolphin.

Of course, this is not a serious matter, I am just curious...

I hope I gave a better explanation this time!
Title: RE: Scripts executable by default
Post by: ralul on 2013/10/17, 01:58:29
Make yourself a script:
Code: [Select]
#!/bin/bash
[ -z $1 ] && exit
[ -d "$1" ] || exit
find "$1" | while read f; do
 [ -f "$f" ] || continue
 h=$(head -n 1 "$f")
 [ "${h:0:3}" = "#!/" ] && chmod +x "$f"
done