gsgp/util/setval

25 lines
375 B
Plaintext
Raw Normal View History

#!/bin/sh
value="$1"
assign="$2"
. "$( dirname $0 )/common"
if [ ! "$value" -o ! "$assign" ]; then
echo "Usage: $0 VALUE ASSIGNMENT" >&2
exit 1
fi
valpath="$HOME/.$GSGP_ID/profiles/$GSGP_PROFILE"
valfile="$valpath/$value"
touch "$valfile" 2>/dev/null
if [ ! -w "$valfile" ]; then
echo "Unable to write value" >&2
exit 2
fi
echo "$assign" > "$valfile"