Skip to content

Instantly share code, notes, and snippets.

@obfusk
Last active May 6, 2024 02:28
Show Gist options
  • Save obfusk/f7522fad46899c29004f123a4d41817a to your computer and use it in GitHub Desktop.
Save obfusk/f7522fad46899c29004f123a4d41817a to your computer and use it in GitHub Desktop.
diff + bat
#!/bin/bash
diff -Naur "$@" | bat -p -l diff
#!/bin/bash
# diff running 2 different commands on the same file
set -e
if [ "$#" -lt 3 ]; then
echo 'usage: diff2c CMD_A CMD_B FILE' >&2
exit 1
fi
cmd_a="$1" cmd_b="$2" file="$3"
diff -Naur <( $cmd_a "$file" ) <( $cmd_b "$file" ) | bat -p -l diff
#!/bin/bash
# diff running the same command on 2 different files
set -e
if [ "$#" -lt 3 ]; then
echo 'usage: diff2f CMD FILE_A FILE_B' >&2
exit 1
fi
cmd="$1" file_a="$2" file_b="$3"
diff -Naur <( $cmd "$file_a" ) <( $cmd "$file_b" ) | bat -p -l diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment