I keep creating practice perl scripts in a linux directory using vi <filename> and need to chmod 751 <filename> before I can run it as I wish to. I'm sure there is a simple way to default my permissions or config them at creation, but I'm not familiar with it - ayuda me por favor.
| |||
|
feedback
|
|
A simple solution would be to make a bash alias for e.g. (untested): function vix {
touch $1
chmod 751 $1
vi $1
}
Note that aliasing vi itself is a bad idea as many other programs call on it directly, which may cause issues with your system. | |||||||
feedback
|
|
751 doesn't make much sense for scripts - it allows "others" to execute the file, but not read it. (For scripts, which don't get setuid honored, this is impossible.) To set default permissions for newly created files, you can use either umask (per-process) or default ACLs (per-directory). But they both can only remove permission bits; neither of them will add the "executable" bit automatically unless the program specifically asks for it. (For example, You will have to follow mjb's suggestion of writing a script that creates a file and immediately updates its permissions. Alternatively, run your practice scripts like | |||||
feedback
|
#!/bash/bin touch $1; chmod 751 $1– tjameson Apr 5 '11 at 19:19