Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > 13f5dcef5358e9d5a2a5a1ae6baf28fc > files > 133

gtkdialog-0.8.3-1.mga5.x86_64.rpm

#!/bin/sh

## Update the number of times the currently selected game has been
## played or append it to the list on first play.

funcxPlayedUpdate() {
	if [ -z "$BASH" ]; then local FUNCNAME=funcxPlayedUpdate; fi
	if [ $DEBUG_TRANSITS -ne 0 ]; then echo "$FUNCNAME(): IN"; fi

	## Local variables.
	local xplayed

	xplayed=`grep "^$treGameList=" $LOCAL_DATA_DIR/xPlayed`
	if [ -z "$xplayed" ]; then
		## First time played so append to list.
		echo "$treGameList=1" >> $LOCAL_DATA_DIR/xPlayed
	else
		## Get the value after the last equals.
		xplayed="${xplayed##*=}"
		xplayed=$((xplayed + 1))
		## Update in place.
		sed -i "s|^$treGameList=.*|$treGameList=$xplayed|" $LOCAL_DATA_DIR/xPlayed
	fi

	if [ $DEBUG_TRANSITS -ne 0 ]; then echo "$FUNCNAME(): OUT"; fi
}