summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2018-10-07 22:57:37 -0400
committerJakob Kaivo <jkk@ung.org>2018-10-07 22:57:37 -0400
commitc6b6dc4083f8330be9576d13f317a054405c17d3 (patch)
tree3836a3e3fc0ecd1a3a55a45d3eeaabccbaeb73f9
parentb4e75fd219e0ca4b8c1b843fa3f8a670bc0b1aa1 (diff)
awk arrays start at 1
-rwxr-xr-xcolor-ls10
1 files changed, 6 insertions, 4 deletions
diff --git a/color-ls b/color-ls
index b068b79..da3ef1f 100755
--- a/color-ls
+++ b/color-ls
@@ -47,7 +47,7 @@ _columns_down () {
}
ncolumns = columns / widest;
- i = 0;
+ i = 1;
while (i < NR) {
# FIXME: this is all jacked up
printf("%-*s", widest, all[(row * ncolumns) + (i % ncolumns)]);
@@ -83,13 +83,15 @@ _columns_across () {
columns = 80;
}
- for (i in all) {
+ i = 1;
+ while (i < NR) {
printf("%-*s", widest, all[i]);
column += widest;
if (column > columns) {
printf("\n");
column = 0;
}
+ i++;
}
if (column != 0) {
@@ -142,8 +144,8 @@ _remove_symbols () {
while getopts ACFHLRSacdfgiklmopqrstux1 option
do
case $option in
- g|l|n|o) output=${output}; dash_1=''; need_dash_F=0;;
- C|m|x) output=${output}; dash_1=-1; need_dash_F=1;;
+ g|l|n|o) output=${option}; dash_1=''; need_dash_F=0;;
+ C|m|x) output=${option}; dash_1=-1; need_dash_F=1;;
1) output=1; dash_1='';;
F) dash_F_specified=-F;;
?) ;;