From 76ea6ee4abfb53c8ec996f6ebe053d46bb4207d4 Mon Sep 17 00:00:00 2001 From: Mario Alegre Date: Thu, 26 Nov 2020 02:43:38 -0500 Subject: [PATCH] more improvements to shw --- shw | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shw b/shw index 0f661ba..1d9630e 100755 --- a/shw +++ b/shw @@ -4,8 +4,11 @@ if [[ ! -t 0 ]]; then less -FX # if there is only one arg and it is not a directory, less it -elif [[ -z "$2" && ! -d "$1" ]]; then +elif [[ "$#" -eq 1 && ! -d "$1" ]]; then less -FX "$1" +# if there are exactly two arguments and neither is a directory, diff them +elif [[ "$#" -eq 2 && ! -d "$1" && ! -d "$2" ]]; then + diff --color=auto -u "$@" # otherwise, run dir else ls -lhAF --color=auto "$@"