0

I run a game from steam which starts with the game companies launcher app where I have to click another button to start the actual game. The game launcher is very slow, contains needless advertising, which I should not be forced to experience as I paid for the game in it's entirety, it is not a free online game paid for by advertising, and it sends my telemetry to different servers around the world!

Someone provided some simple code in a community guide to bypass the launcher but I cannot get it to work for reasons that make no sense to me.

Their simple code is to put this command in steam's properties for the game which works for them and other users

eval $( echo “%command%” | sed -E “s#Launcher/dowser.exe#Cities2.exe#g” )

But nothing happens when I start the game in steam, it just exits after 30 seconds or so. So I added tee to the command to see what sed ouputs, like this

eval $( echo “%command%” | sed -E “s#Launcher/dowser.exe#Cities2.exe#g” | tee ~/foot.txt)

And foo.txt is empty, which makes no sense because if I run this command

eval $( echo “%command%” | foo.bash )

Which is this script

#/bin/bash

echo "$*" > ~/foo.txt

Then foo.txt has the expected command line received by bash on STDIN that sed should be receiving.

So then I ran the same sed command with the --debug switch and get this output in a log

SED PROGRAM:
  s/Launcher\/dowser.exe/Cities2.exe/g
INPUT:   'STDIN' line 1
PATTERN: /home/user/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=949230 -- /home/user/.local/share/Steam/ubuntu12_32/steam-launch-wrapper -- '/home/user/.local/share/Steam/steamapps/common/SteamLinuxRuntime_sniper'/_v2-entry-point --verb=waitforexitandrun -- '/home/user/.local/share/Steam/steamapps/common/Proton 8.0'/proton waitforexitandrun  '/home/user/.local/share/Steam/steamapps/common/Cities Skylines II/Launcher/dowser.exe'
COMMAND: s/Launcher\/dowser.exe/Cities2.exe/g
MATCHED REGEX REGISTERS
  regex[0] = 409-428 'Launcher/dowser.exe'
PATTERN: /home/user/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=949230 -- /home/user/.local/share/Steam/ubuntu12_32/steam-launch-wrapper -- '/home/user/.local/share/Steam/steamapps/common/SteamLinuxRuntime_sniper'/_v2-entry-point --verb=waitforexitandrun -- '/home/user/.local/share/Steam/steamapps/common/Proton 8.0'/proton waitforexitandrun  '/home/user/.local/share/Steam/steamapps/common/Cities Skylines II/Cities2.exe'
END-OF-CYCLE:
/home/user/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=949230 -- /home/user/.local/share/Steam/ubuntu12_32/steam-launch-wrapper -- '/home/user/.local/share/Steam/steamapps/common/SteamLinuxRuntime_sniper'/_v2-entry-point --verb=waitforexitandrun -- '/home/user/.local/share/Steam/steamapps/common/Proton 8.0'/proton waitforexitandrun  '/home/user/.local/share/Steam/steamapps/common/Cities Skylines II/Cities2.exe'

So sed is receiving the expected data from steam on STDIN, and the sed commandline script is producing the expected result, but inexplicably eval is not recieving the sed output or not executing it.

Then just to see what happens, I ran the same command again but chained the sed output from the debug log after the sed command, so the result and output from sed would be thrown away, and the appended command would be run, like this

eval $( echo “%command%” | sed -E “s#Launcher/dowser.exe#Cities2.exe#g” & /home/user/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=949230 -- /home/user/.local/share/Steam/ubuntu12_32/steam-launch-wrapper -- '/home/user/.local/share/Steam/steamapps/common/SteamLinuxRuntime_sniper'/_v2-entry-point --verb=waitforexitandrun -- '/home/user/.local/share/Steam/steamapps/common/Proton 8.0'/proton waitforexitandrun  '/home/user/.local/share/Steam/steamapps/common/Cities Skylines II/Cities2.exe')

And the game successfully runs without the launcher!!!

I don't get it, why is eval not executing the sed output as the command, but does execute the command line that sed apparently does output when I chain it after the sed command?

The only downside to that execution was that steam does not recognize that the game has closed when I exit it, but I could live with that.

I am running on Ubuntu 23.10, using steam in X

  • 1
    Most likely an issue of shell variables not getting set properly. When evaling, some variable is likely getting set. But when the game is launched the first way, it's a new process, which doesn't have access to the variable that was set by eval. When you launch the game using eval and && simultaneously, you're ensuring that all variables/functions that were defined by eval are available to the game executable. – B215826 Dec 11 '23 at 16:39
  • Really? I'm not sure I understand that. The command I appended after the single & is the sed STDOUT so any variables being evaluated would be the same in both evaluations. – nobody special Dec 11 '23 at 17:36
  • The single & "launches" the preceding command and runs it in the background, and the cmd-line processor proceeds to the next command on the cmd line. Any environment vars scoped to the first script will not affect the 2nd script. As far as && carrying env vars over, I guess I would have to see that. – shellter Dec 11 '23 at 20:11
  • maybe you have a type ~/foot.txt? – akostadinov Dec 11 '23 at 22:35
  • Also, besides eval, you could try exec bash -c "$(echo “%command%” | sed -E “s#Launcher/dowser.exe#Cities2.exe#g” )" – akostadinov Dec 11 '23 at 22:38
  • @akostadinov I had to escape the quotes but that didn't work either unfortunately. – nobody special Dec 12 '23 at 15:16
  • @shellter Yeah that's as I understand it, the sed output environment should not affect the next command after the single &, which is why I'm confused that the sed output works when I run it after the single & – nobody special Dec 12 '23 at 15:19
  • Can we assume that steam evaluates %command% as /full/path/to/steam(.exe) ? Can you update your Q with the 2-3 most likely values that are %command%? – shellter Dec 12 '23 at 15:47
  • Regarding "Someone provided some simple code" - simple code is usually fragile code that only handles sunny-day cases while robust code is usually about 80% error handling to handle the rainy-day cases. – Ed Morton Dec 13 '23 at 14:14
  • 2
    @EdMorton That is the answer, thank-you. Funny thing is my eyes kept getting attracted to the quotes but it didn't register in my head because I do so little bash scripting. – nobody special Jan 27 '24 at 14:59

2 Answers2

2

Your code is using curly quotes instead of straight quotes so fix that.

FYI if you had copy/pasted your code into shellcheck.net (as recommended by the tag and others) it would have told you about that issue. That's another reason it's good to tag shell questions with the shell you're using - the info associated with the tag for that shell might contain some useful information.

Ed Morton
  • 31,617
0

The web site I copied the command off had curly quotes in the code which I did not notice, and replacing them with straight quotes as suggested by @Ed Morton solved the issue.