moby/contrib/gitdm/generate_aliases.sh
Tianon Gravi 52379fa76d Convert script shebangs from "#!/bin/bash" to "#!/usr/bin/env bash"
This is especially important for distributions like NixOS where `/bin/bash` doesn't exist, or for MacOS users who've installed a newer version of Bash than the one that comes with their OS.

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
2017-02-13 11:01:54 -08:00

16 lines
384 B
Bash
Executable file

#!/usr/bin/env bash
#
# This script generates a gitdm compatible email aliases file from a git
# formatted .mailmap file.
#
# Usage:
# $> ./generate_aliases <mailmap_file> > aliases
#
cat $1 | \
grep -v '^#' | \
sed 's/^[^<]*<\([^>]*\)>/\1/' | \
grep '<.*>' | sed -e 's/[<>]/ /g' | \
awk '{if ($3 != "") { print $3" "$1 } else {print $2" "$1}}' | \
sort | uniq