shkv

#!/bin/sh

if [[ "$1" == "set" ]]; then

    VARNAME=$(echo $2 | awk -F "=" '{print $1}')
    VARTEXT=$(cat db.db | grep "$VARNAME=")
    if [ "$VARTEXT" ]; then
         cat db.db | sed 's/'"$VARTEXT"'/'"$2"'/g' > db.tmp
         mv db.tmp db.db
    else
        echo "$2" >> db.db
    fi
fi

if [[ "$1" == "get" ]]; then
    cat db.db | grep "$2=" | sed 's/'"$2"'=//g'
fi

Benutzung:

# ./shkv.sh set varScriptDate=200909
# ./shkv.sh set Testvar=Testwert
# ./shkv.sh set "cmd=irgendwas=wasanderes"

# ./shkv.sh get varScriptDate
200909
# ./shkv.sh get Testvar
Testwert
# ./shkv.sh get cmd
irgendwas=wasanderes