I have a command that I would like to run from a shell script:
LD_PRELOAD='/usr/$LIB/libstdc++.so.6' DISPLAY=:0 steam
This command is necessary to run Steam correctly on my system. If I try to run Steam without this command, the icon appears on the launcher then disappears again, leaving just a process that I have to end in system monitor.
If I cut and paste that command directly into a terminal, it works perfectly. Steam opens and works just fine, and the terminal sits there in the background giving output until Steam is closed again.
If I try to run that command from a shell script, it doesn't work anymore. The same problematic behavior shows up.
Interestingly, if I go into the terminal and type
./Steam.sh - which is the name of my script - Steam opens correctly.
Steam.sh is located in my home folder, and I run all the commands from my home folder in the terminal, and I have given execute permission to Steam.sh. I have also tried adding
& to the end of the command in the shell script, but that hasn't helped.
Any idea why this command works differently depending on whether it's launched from a shell script or from a terminal? I thought shell scripts were supposed to be basically the same thing as running commands from a terminal.