From 21f62c8c2af0db01094b73faf77065ba39abad8a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 24 Aug 2016 11:51:47 +1200 Subject: Force --hide-control-chars on ls(1) if available I prefer it to literal or C-style escaping representations, and ls(1) isn't for scripting output anyway. --- sh/shrc.d/ls.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sh/shrc.d/ls.sh') diff --git a/sh/shrc.d/ls.sh b/sh/shrc.d/ls.sh index 8fd42431..705936e6 100644 --- a/sh/shrc.d/ls.sh +++ b/sh/shrc.d/ls.sh @@ -18,6 +18,12 @@ ls() { [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] && set -- --color=auto "$@" + # Add --hide-control-chars if present; we always want this interactively, + # even if the output is to a pager; we shouldn't be trying to script ls(1) + # output anyway + [ -e "$HOME"/.cache/ls/hide-control-chars ] && + set -- --hide-control-chars "$@" + # Add --time-style='+%Y-%m-%d %H:%M:%S' to show trailing indicators of the # filetype [ -e "$HOME"/.cache/ls/time-style ] && -- cgit v1.2.3