Knowledge Base

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

aoe2de-get-username.sh (Source)

#!/bin/sh
if test -z "${INFILE}" ;
then
    scriptdir="$( dirname "$( readlink -f "${0}" )" )"
    # find first one
    INFILE="$( find "${scriptdir}" "${scriptdir}/.." "${scriptdir}/../.." -ipath '*/steam_settings/configs.user.ini' -print -quit )"
fi
awk -F'=' '$1~/account_name/{print $NF}' "${INFILE}"