Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Re-calculates and updates the value of `check` in me.pou.app_preferences.xml for the Android game Pou
#!/bin/bash
# Read the value of state from me.pou.app_preferences.xml
state=$(grep -oPm1 '(?<=<string name="state">)[^<]+' me.pou.app_preferences.xml)
# Format state to the hashable string & calculate it's hash
check=$(echo -n "p@v_4"${state//&quot;/\"} | md5sum | awk '{ print $1 }')
# Update the value of check in the me.pou.app_preferences.xml
# Regex from https://stackoverflow.com/a/17333829/9767089
sed -i -r 's/(<string name="check">)[^<]*/<string name="check">'$check'/g' me.pou.app_preferences.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment