Decide if I want 'lt' (ls | tail) too
dblume

dblume commited on 2024-01-19 17:06:53
Showing 1 changed files, with 9 additions and 1 deletions.

... ...
@@ -153,11 +153,19 @@ alias clip="expand | cut -b1-\$COLUMNS"
153 153
 lh() {
154 154
 #    ls --color=always -1tqh "$@" | head -$(($LINES/3))
155 155
     ls --color=always -ltqh "$@" | head -$(($LINES/3)) | tail --lines=+2
156
-    if [ $(ls -1 | wc -l) -gt $(($LINES/3)) ]; then
156
+    if [ $(ls -1 "$@" | wc -l) -gt $(($LINES/3)) ]; then
157 157
         echo ...
158 158
     fi
159 159
 }
160 160
 
161
+# lh = "ls | head" (newest at top), lt = "ls | tail" (newest at the bottom)
162
+lt() {
163
+    if [ $(ls -1 "$@" | wc -l) -gt $(($LINES/3)) ]; then
164
+        echo ...
165
+    fi
166
+    ls --color=always -rltqh "$@" | tail --lines=$(($LINES/3))
167
+}
168
+
161 169
 # For httpie: https://github.com/jakubroztocil/httpie#installation
162 170
 alias https='http --default-scheme=https'
163 171
 
164 172