aboutsummaryrefslogtreecommitdiff
path: root/sh/shrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-12-19 13:37:06 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-12-19 13:37:06 +1300
commit6c8b45460a614969feb5f74798df18c417ee16b1 (patch)
tree105aee5f301a7c2298468bdd058d9b7cc348c0b2 /sh/shrc.d
parentOnly add -u to diff() call if more than two args (diff)
downloaddotfiles-6c8b45460a614969feb5f74798df18c417ee16b1.tar.gz
dotfiles-6c8b45460a614969feb5f74798df18c417ee16b1.zip
Make diff default even more conservative
Diffstat (limited to 'sh/shrc.d')
-rw-r--r--sh/shrc.d/diff.sh6
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