What is this script doing?
-
I’ve been trying to get steam to close when I exit a steam game in Emulationstation using this script.
#!/bin/bash # steamlaunch steam -silent -applaunch $1 2>&1 | tee >( while read line; do if [[ $line == *"Game process removed: AppID $1"* ]]; then sleep 10; steam -shutdown; break fi done )
It works sometimes and have been trying to troubleshoot why it doesn’t work all of the time? It seems to work better if I open emulationstation and only launch the steam game and then exit. If I launch some other game and exit then launch the steam game it hangs and won’t exit back to emulationstation. Specifically wondering what this part is doing?
$1 2>&1 | tee >(
Pulled it from here which says:
Used tee >( ... ) to allow the output to continue to STDOUT -
@WhiteT982 $1 is passing the 1st parameter (probably your steam game) to the "steam" command.
&2>1 is redirecting stderr to stdout (so you can see if an error occurs while reading stdout).
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.