for index in "${!lines[@]}"; do
line=${lines[index]}
hardlinks=${hl[index]}
- if ! [[ $line == [-a-ZA-Z][-r][-w][-xsS][-r][-w][-xsS][-r][-w][-xtT]* ]]; then
+ if [[ $line != [-a-zA-Z][-r][-w][-xsS][-r][-w][-xsS][-r][-w][-xtT]* ]]; then
# line we don't understand
printf "%s\n" "$line"
- else
- perm=0
- for (( x=0; x<=8; x++ )); do
- y=${line:$(( -1*x + 9 )):1}
- [[ $y == [tT] ]] && perm=$(( perm + 512 ))
- if [[ $y == [sS] ]]; then
- [[ $x == 3 ]] && perm=$(( perm + 1024 ))
- [[ $x == 6 ]] && perm=$(( perm + 2048 ))
- fi
- [[ $y != [-ST] ]] && perm=$(( perm + 2**x ))
- done
- if $aclchar; then
- y="${line:11}"
- else
- y="${line:10}"
- fi
- middle=${y#*[^ ]* }
- size=${middle#*[^ ]* *[^ ]* }
- middle=${middle%"$size"}
- tail=${size#*[^ ]* }
- size=${size%"$tail"}
- declare -i sizePadding="${#size} - 1"
- size=( $size ) # remove spaces
- size=${size/.?/}
-
- printf "%s%4o%${hardlink_spacing}s%s%${sizePadding}s%s\n" \
- "${line:0:1}" $perm "$hardlinks" " $middle" "$size" " $tail"
+ continue
fi
+ perm=0
+ for (( x=0; x<=8; x++ )); do
+ y=${line:$(( -1*x + 9 )):1}
+ [[ $y == [tT] ]] && perm=$(( perm + 512 ))
+ if [[ $y == [sS] ]]; then
+ [[ $x == 3 ]] && perm=$(( perm + 1024 ))
+ [[ $x == 6 ]] && perm=$(( perm + 2048 ))
+ fi
+ [[ $y != [-ST] ]] && perm=$(( perm + 2**x ))
+ done
+ if $aclchar; then
+ y="${line:11}"
+ else
+ y="${line:10}"
+ fi
+ middle=${y#*[^ ]* }
+ size=${middle#*[^ ]* *[^ ]* }
+ middle=${middle%"$size"}
+ tail=${size#*[^ ]* }
+ size=${size%"$tail"}
+ declare -i sizePadding="${#size} - 1"
+ size=( $size ) # remove spaces
+ size=${size/.?/}
+
+ printf "%s%4o%${hardlink_spacing}s%s%${sizePadding}s%s\n" \
+ "${line:0:1}" $perm "$hardlinks" " $middle" "$size" " $tail"
done
}