24 lines
459 B
Bash
Executable file
24 lines
459 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
perms=(___ __x _w_ _wx r__ r_x rw_ rwx)
|
|
|
|
perms() {
|
|
local perm perm_str
|
|
|
|
for perm do
|
|
perm_str=$perm_str${perms[$perm]}
|
|
done
|
|
|
|
printf %s "$perm_str"
|
|
}
|
|
|
|
for owner in {0..7}; do
|
|
for group in {0..7}; do
|
|
for universe in {0..7}; do
|
|
printf 'chmod_%s() {\n' "$(perms "$owner" "$group" "$universe")"
|
|
printf ' chmod %d%d%d "$@"\n' "$owner" "$group" "$universe"
|
|
printf '}\n'
|
|
printf '\n'
|
|
done
|
|
done
|
|
done
|