Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

aoe2de-get-account-steamid.sh (Source)

#!/bin/sh
if test -z "${INFILE}" ;
then
    scriptdir="$( dirname "$( readlink -f "${0}" )" )"
    # find first one. IGNORE the saves/settings/configs.user.ini which is the auto-generated one.
    INFILE="$( find "${scriptdir}" "${scriptdir}/.." "${scriptdir}/../.." -ipath '*/steam_settings/configs.user.ini' -print -quit )"
fi
final_steamid="$( awk -F'=' '$1~/account_steamid/{print $NF}' "${INFILE}" )"
echo "account_steamid = ${final_steamid}"