From f2769c23e35fcb5d3556cc9448334e39edc7e447 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 30 Mar 2018 13:40:53 -0300 Subject: Add sl script --- scripts/sl | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 scripts/sl (limited to 'scripts') 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 -- cgit v1.2.3