scripts/db in rvm-0.1.39 vs scripts/db in rvm-0.1.40
- old
+ new
@@ -23,13 +23,13 @@
usage
exit 1
else
value="$*"
if [[ "unset" = "$value" ]] || [[ "delete" = "$value" ]] ; then
- sed -i.tmp "s#^$key=.*\$##" $database_file
+ sed -i.tmp -e "s#^$key=.*\$##" -e '/^$/d' $database_file
else
if [[ -z "$value" ]] ; then # get
- awk -F= '/^'"$key"'=/' $database_file | sed "s#^$key=##"
+ awk -F= '/^'"$key"'=/' $database_file | sed -e "s#^$key=##" -e '/^$/d'
else # set
if [[ -z "$(awk -F= "/^'"$key"'=/{print $2}" $database_file)" ]] ; then # append
echo "$key=$value" >> $database_file
else # overwrite
sed -i.tmp "s#^$key=.*\$#$key=$value#" $database_file