bin/addcontact @ 41849d4b8593

More
author Steve Losh <steve@stevelosh.com>
date Tue, 28 Nov 2023 16:23:43 -0500
parents dbc095424fd1
children (none)
#!/usr/bin/env bash

set -euo pipefail

# USAGE: addcontact 'Kevin Wu <kevinwuhoo@gmail.com>'

RAW="$1"

EMAIL="$(echo "$1" | grep -Po '<.+>' | tr -d '<>')"
NAME="$(echo "$1" | sed -e 's/ [^ ]*$//')"

printf "$EMAIL"'\t'"$NAME"'\t\n' >> ~/.contacts