Skip to content

Instantly share code, notes, and snippets.

@unhammer
Created Jan 5, 2012
Embed
What would you like to do?
helper to dwdiff
#!/bin/bash
# Default -c on if stdout is a terminal:
if [ -t 1 ]; then C='-c';
else C=; fi
# Assume --diff-input if stdin is not a terminal:
if [ -t 0 ]; then DI=
else DI='--diff-input'; fi
# Since the -c option removes them; I like having them always on:
MARKERS=(-w'[-' -x'-]' -y'{+' -z'+}')
dwdiff $C $DI ${MARKERS[*]} "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment