~pi/aka

ref: 2d5569bf053ca59b1d502e8e1bea33f4dd76a9db aka/aka_tiny -rw-r--r-- 321 bytes
2d5569bfPaul Ivanov add related project and doit example 1 year, 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
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 $*