~pi/aka

ref: fb83cb1933071ccdd4c4387d6590f6d54864b307 aka/aka_tiny -rw-r--r-- 378 bytes
fb83cb19Paul Ivanov more specific install instructions 1 year, 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
# aka, written by Paul Ivanov: https://git.sr.ht/~pi/aka
aliasFile=${AKA_FILE:-./.aka}
if [ $# -ge 3 ]  && [ $1 = alias ] ; then
    cmd=$2
    shift 2
    [ -e "$aliasFile" ] && grep -v "alias $cmd=" "$aliasFile"  > "$aliasFile"~
    echo "alias $cmd='$*'" >> "$aliasFile"~ && mv "$aliasFile"~ "$aliasFile"
    exit 0
fi
[ -e "$aliasFile" ] && . "$aliasFile"
eval $*