I'm struggling with storing the return value (0 or 1) of my function in a variable. Whatever I try, $var ends up being empty or I run into error messages. Here is my specific code:
function screen_exists() {
if screen -list | grep -q "${1}"; then
return 0
else
return 1
fi
}
VAR=$(screen_exists "${PLAYER_SCREEN_NAME}")
echo ${VAR}
I've also tried with a super simple function that always returns 0, but same outcome.