aboutsummaryrefslogtreecommitdiff
path: root/bin/sl
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2018-12-22 18:19:29 -0200
committerEuAndreh <eu@euandre.org>2018-12-22 18:19:29 -0200
commitd4e6648afd61205136c98fdc56cf151eb437a078 (patch)
tree4503e78d64133edeb8679c57d58ac96d6fef7e9e /bin/sl
parentmrconfig.ini. (diff)
downloaddotfiles-d4e6648afd61205136c98fdc56cf151eb437a078.tar.gz
dotfiles-d4e6648afd61205136c98fdc56cf151eb437a078.tar.xz
Move external scripts to bin/.
Diffstat (limited to 'bin/sl')
-rwxr-xr-xbin/sl13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/sl b/bin/sl
new file mode 100755
index 0000000..2333462
--- /dev/null
+++ b/bin/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