From 9820de29e08156b39b0f3afcc59c0e8f2f544b2b Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 26 Aug 2016 13:48:38 +1200 Subject: Add tree() --- sh/shrc.d/tree.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sh/shrc.d/tree.sh (limited to 'sh/shrc.d/tree.sh') diff --git a/sh/shrc.d/tree.sh b/sh/shrc.d/tree.sh new file mode 100644 index 00000000..5feb8ca3 --- /dev/null +++ b/sh/shrc.d/tree.sh @@ -0,0 +1,9 @@ +# I don't like the LS_COLORS environment variable, but GNU tree(1) doesn't +# color its output by default without it; this will coax it into doing so with +# the default colors when writing to a terminal. +tree() { + [ -t 1 ] && + [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] && + set -- -C "$@" + command "$@" +} -- cgit v1.2.3