summaryrefslogtreecommitdiff
path: root/scripts/misc
diff options
context:
space:
mode:
authorThomas Ulmer <thomasmulmer02@gmail.com>2026-02-04 14:24:16 -0800
committerThomas Ulmer <thomasmulmer02@gmail.com>2026-02-04 14:24:16 -0800
commit9139a1b136fa2b5adfcac0ac09a4f61aa1ee1ff4 (patch)
treede82bc4776b87f1fbb86f14b4a15d35d009ddd28 /scripts/misc
parenta9bf8f30c746f5b28bb7eb6938e8390127081a32 (diff)
full reorg
Diffstat (limited to 'scripts/misc')
-rwxr-xr-xscripts/misc/lk.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/misc/lk.sh b/scripts/misc/lk.sh
new file mode 100755
index 0000000..5f760c6
--- /dev/null
+++ b/scripts/misc/lk.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# This is helper that should replace a number of common commands
+#
+# It is intended to be named `lk`, short for "look"
+
+longView=${PAGER:-$(which less || which more || echo "cat")}
+dirView="ls --color=always -Alh"
+
+if [ $# -lt 1 ]; then
+ # take stdin instead
+ $dirView $(pwd) | ${longView}
+fi
+
+for a in $@; do
+ if [ $a == "" ]; then
+ echo "Empty argument skipped"
+ elif [ ! -e $a ]; then
+ echo "$a does not exist" 1>&2
+ exit -1
+ elif [ -d $a ]; then
+ $dirView $a
+ elif [ $(tput lines) -ge $(($(wc -l < $a) - 2)) ]; then
+ cat $a
+ else
+ ${longView} $a
+ fi
+done