File tree Expand file tree Collapse file tree 1 file changed +8
-19
lines changed
Expand file tree Collapse file tree 1 file changed +8
-19
lines changed Original file line number Diff line number Diff line change @@ -691,29 +691,18 @@ update_user_value() {
691691
692692increase_user_value() {
693693 USER="$1"
694- key="$2"
695-
696- # Defining conf
697- conf="$V_USERS/$USER/user.conf"
698-
699- # Deleting $
700- key=$(echo "${key//$/}")
694+ key="${2//$}"
701695
702696 # Parsing current value
703- current_value=$(grep "$key=" $conf |cut -f 2 -d \')
704-
705- # Checking result
706- if [ -z "$current_value" ]; then
707- echo "Error: Parsing error"
708- log_event 'debug' "$E_PARSING $V_EVENT"
709- exit $E_PARSING
697+ conf="$V_USERS/$USER/user.conf"
698+ old=$(grep "$key=" $conf | cut -f 2 -d \')
699+ if [ -z "$old" ]; then
700+ old=0
710701 fi
711702
712- # Plus one
713- new_value=$(expr $current_value + 1 )
714-
715- # Changing config
716- sed -i "s/$key='$current_value'/$key='$new_value'/g" $conf
703+ # Increasing
704+ new=$((old + 1 ))
705+ sed -i "s/$key='$old'/$key='$new'/g" $conf
717706}
718707
719708is_type_valid() {
You can’t perform that action at this time.
0 commit comments