This commit is contained in:
Connor Olding 2013-05-20 12:54:10 -07:00
parent ea6bf420b2
commit 31ebe0b649

22
lsf.sh
View file

@ -8,7 +8,7 @@
# echo -E is used to avoid \033 expanding # echo -E is used to avoid \033 expanding
# bare asterisks are escaped to prevent globbing # bare asterisks are escaped to prevent globbing
# arrays are used instead of relying on word expansion # 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: set better defaults for quick glances at filesize
# TODO: utilize filetype; opt to strip path from output # 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 for x in $(groups); do echo "us[\"$x\"]=1"; done
i=0;for x in bla red gre yel blu pur cya whi; do i=0;for x in bla red gre yel blu pur cya whi; do
echo -E $x'="\033[3'${i}'m"' 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"' echo -E '="\033[1;3'${i}'m"'
let i++ let i++
done 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) fus=(B B B K K M M G G T)
fcs=(BLA cya CYA CYA yel yel pur pur red red) fcs=(BLA cya CYA CYA yel yel pur pur red red)
pc=(BLA WHI yel YEL blu BLU gre GRE) 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" 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" echo "f[\"sizes\"]=$i"
i=0;for x in ${fut[@]};do echo "fu[\"time,$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 "${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 "${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 "${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 "${pc[@]}"; do echo "pc[$i]=$x"; let i++;done
)" )"
echo -E "$begin" echo -E "$begin"
} }
@ -158,8 +158,8 @@ function fixlen(str, len) {
print print
}' }'
shift $(($OPTIND-1)) shift $((OPTIND-1))
find "${1:-.}" -maxdepth 1 -print0 | xargs -0 stat -t | awk --non-decimal-data "$program" find "${1:-.}" -maxdepth 1 -exec stat -t {} + | awk --non-decimal-data "$program"
} }
case $- in case $- in