Skip to content

Instantly share code, notes, and snippets.

@unhammer
Created January 5, 2012 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unhammer/1564485 to your computer and use it in GitHub Desktop.
Save unhammer/1564485 to your computer and use it in GitHub Desktop.
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