diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-19 13:37:06 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-19 13:37:06 +1300 |
commit | 6c8b45460a614969feb5f74798df18c417ee16b1 (patch) | |
tree | 105aee5f301a7c2298468bdd058d9b7cc348c0b2 /sh | |
parent | Only add -u to diff() call if more than two args (diff) | |
download | dotfiles-6c8b45460a614969feb5f74798df18c417ee16b1.tar.gz dotfiles-6c8b45460a614969feb5f74798df18c417ee16b1.zip |
Make diff default even more conservative
Diffstat (limited to 'sh')
-rw-r--r-- | sh/shrc.d/diff.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sh/shrc.d/diff.sh b/sh/shrc.d/diff.sh index 179ced94..9ba2f983 100644 --- a/sh/shrc.d/diff.sh +++ b/sh/shrc.d/diff.sh @@ -1,14 +1,14 @@ -# Use a unified format for diff(1) by default +# Use a unified format for diff(1) by default if two files and no options given diff() { if ( for arg ; do case $arg in - -*) shift ;; --) shift ; break ;; + -*) return 1 ;; *) break ;; esac done - [ "$#" -gt 1 ] + [ "$#" -eq 2 ] ) ; then set -- -u "$@" fi |