aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
Diffstat (limited to 'sh')
-rw-r--r--sh/shrc.d/diff.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/sh/shrc.d/diff.sh b/sh/shrc.d/diff.sh
index 2c752c8d..179ced94 100644
--- a/sh/shrc.d/diff.sh
+++ b/sh/shrc.d/diff.sh
@@ -1,4 +1,16 @@
# Use a unified format for diff(1) by default
diff() {
- command diff -u "$@"
+ if (
+ for arg ; do
+ case $arg in
+ -*) shift ;;
+ --) shift ; break ;;
+ *) break ;;
+ esac
+ done
+ [ "$#" -gt 1 ]
+ ) ; then
+ set -- -u "$@"
+ fi
+ command diff "$@"
}