diff --git a/lsf.sh b/lsf.sh index b628105..adbfc6c 100755 --- a/lsf.sh +++ b/lsf.sh @@ -8,7 +8,7 @@ # echo -E is used to avoid \033 expanding # bare asterisks are escaped to prevent globbing # arrays are used instead of relying on word expansion -# for loops over ${array[@]} as it's the only commonality I know +# for loops over "${array[@]}" as it works the same in both # TODO: set better defaults for quick glances at filesize # TODO: utilize filetype; opt to strip path from output @@ -24,7 +24,7 @@ awk -F: '{print "gnames["$3"]=\""$1"\""}' < /etc/group for x in $(groups); do echo "us[\"$x\"]=1"; done i=0;for x in bla red gre yel blu pur cya whi; do echo -E $x'="\033[3'${i}'m"' - echo -n "$x" | tr '[a-z]' '[A-Z]' + echo -n "$x" | tr a-z A-Z echo -E '="\033[1;3'${i}'m"' let i++ done @@ -53,15 +53,15 @@ fs=( 0 K K\*8 M M\*8 G G\*8 T T\*8) fus=(B B B K K M M G G T) fcs=(BLA cya CYA CYA yel yel pur pur red red) pc=(BLA WHI yel YEL blu BLU gre GRE) -i=0;for x in ${ft[@]}; do echo "f[\"time,$i\"]=$x"; let i++;done +i=0;for x in "${ft[@]}"; do echo "f[\"time,$i\"]=$x"; let i++;done echo "f[\"times\"]=$i" -i=0;for x in ${fs[@]}; do echo "f[\"size,$i\"]=$x"; let i++;done +i=0;for x in "${fs[@]}"; do echo "f[\"size,$i\"]=$x"; let i++;done echo "f[\"sizes\"]=$i" -i=0;for x in ${fut[@]};do echo "fu[\"time,$i\"]=\"$x\"";let i++;done -i=0;for x in ${fus[@]};do echo "fu[\"size,$i\"]=\"$x\"";let i++;done -i=0;for x in ${fct[@]};do echo "fc[\"time,$i\"]=$x"; let i++;done -i=0;for x in ${fcs[@]};do echo "fc[\"size,$i\"]=$x"; let i++;done -i=0;for x in ${pc[@]}; do echo "pc[$i]=$x"; let i++;done +i=0;for x in "${fut[@]}";do echo "fu[\"time,$i\"]=\"$x\"";let i++;done +i=0;for x in "${fus[@]}";do echo "fu[\"size,$i\"]=\"$x\"";let i++;done +i=0;for x in "${fct[@]}";do echo "fc[\"time,$i\"]=$x"; let i++;done +i=0;for x in "${fcs[@]}";do echo "fc[\"size,$i\"]=$x"; let i++;done +i=0;for x in "${pc[@]}"; do echo "pc[$i]=$x"; let i++;done )" echo -E "$begin" } @@ -158,8 +158,8 @@ function fixlen(str, len) { print }' - shift $(($OPTIND-1)) - find "${1:-.}" -maxdepth 1 -print0 | xargs -0 stat -t | awk --non-decimal-data "$program" + shift $((OPTIND-1)) + find "${1:-.}" -maxdepth 1 -exec stat -t {} + | awk --non-decimal-data "$program" } case $- in