aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2018-03-30 13:40:53 -0300
committerEuAndreh <eu@euandre.org>2018-03-30 13:40:53 -0300
commitf2769c23e35fcb5d3556cc9448334e39edc7e447 (patch)
tree9feb49d3d1f710e71ff0220cb883f13a83c7b07f /scripts
parentUpda borg files (diff)
downloaddotfiles-f2769c23e35fcb5d3556cc9448334e39edc7e447.tar.gz
dotfiles-f2769c23e35fcb5d3556cc9448334e39edc7e447.tar.xz
Add sl script
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/sl13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/sl b/scripts/sl
new file mode 100755
index 0000000..2333462
--- /dev/null
+++ b/scripts/sl
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+# Taken from:
+# https://gir.st/blog/sl-alt.htm
+
+# sl - prints a mirror image of ls. (C) 2017 Tobias Girstmair, https://gir.st/, GPLv3
+
+LEN=$(ls "$@" |wc -L) # get the length of the longest line
+
+ls "$@" | rev | while read -r line
+do
+ printf "%${LEN}.${LEN}s\\n" "$line" | sed 's/^\(\s\+\)\(\S\+\)/\2\1/'
+done \ No newline at end of file