1
1
mirror of https://github.com/chubin/cheat.sh.git synced 2024-12-03 03:24:22 +03:00

chmod.sh '888' is now invalid

This commit is contained in:
Your Name 2020-06-11 05:25:28 -04:00
parent 5bdf06963b
commit 8814488e26

View File

@ -20,6 +20,7 @@ chmod_calc(){
if [[ $1 =~ ^-?[0-9]+$ && ${#1} -ge 1 && ${#1} -le 4 ]]
then
p_n=$(printf "%04s\n" "$1" | tr ' ' '0')
echo $p_n | grep -q '[8-9]' && return 1
for (( i=0; i<${#p_n}; i++ ))
do
num=$(echo "obase=2;${p_n:$i:1}" | bc | xargs printf '%03d')