Commit b0052c79 authored by Matthieu PETIOT's avatar Matthieu PETIOT Committed by Marc Cornellà
Browse files

Add argument to set644 and set755 perms alias. (#6959)

This can avoid big mistakes as this I just made.
I thought I could give it an argument. So, now, it is possible.
parent dd8cf513
...@@ -4,6 +4,6 @@ Plugin to handle some unix filesystem permissions quickly ...@@ -4,6 +4,6 @@ Plugin to handle some unix filesystem permissions quickly
### Usage ### Usage
* `set755` recursively sets all directories located within the current working directory and sub directories to octal 755. * `set755` recursively sets all given directories (default to .) to octal 755.
* `set644` recursively sets all files located within the current working directory and sub directories to octal 644. * `set644` recursively sets all given files (default to .) to octal 644.
* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases. * `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases.
...@@ -6,10 +6,14 @@ ...@@ -6,10 +6,14 @@
### Aliases ### Aliases
# Set all files' permissions to 644 recursively in a directory # Set all files' permissions to 644 recursively in a directory
alias set644='find . -type f ! -perm 644 -print0 | xargs -0 chmod 644' set644() {
find "${@:-.}" -type f ! -perm 644 -print0 | xargs -0 chmod 644
}
# Set all directories' permissions to 755 recursively in a directory # Set all directories' permissions to 755 recursively in a directory
alias set755='find . -type d ! -perm 755 -print0 | xargs -0 chmod 755' set755() {
find "${@:-.}" -type d ! -perm 755 -print0 | xargs -0 chmod 755
}
### Functions ### Functions
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment