X-Git-Url: https://iankelling.org/git/?p=small-misc-bash;a=blobdiff_plain;f=ll-function;fp=ll-function;h=51f72ffec1a093571ffd6b139e1bfcf6e1c96b52;hp=eb04f916cf3a986ffb8d594efe72074c56d65bba;hb=fa314fa80b58ed5342264cfd45adfeaec4c291bf;hpb=02239b8021771f96788497c79161fb078898c576 diff --git a/ll-function b/ll-function index eb04f91..51f72ff 100644 --- a/ll-function +++ b/ll-function @@ -82,36 +82,36 @@ EOF 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 }