Need help with escaping characters in a WINE Shell script :/

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
Maxunit
Newbie
Newbie
Posts: 1
Joined: Fri Feb 13, 2015 10:43 pm

Need help with escaping characters in a WINE Shell script :/

Post by Maxunit »

Dear WINEHQ Community,

I am currently trying to host a Game Server, which only runs on Windows, with WINE. It ran fine until the Developers released an update today which introduced a couple new features and now I have to add parameters to the command line, which include quotation marks.

The example bash script:

Code: Select all

wine CAGGameServer-Win32-Shipping.exe cag_p?PlanetManagerName="FUNTOWN"?adminpassword=thisisnttherealpassword?steamsockets?Port=7777?PeerPort=7778?QueryPort=27015?MaxPlayers=32?CloudDir="Cloud1"?ServerName="My Cool Home Server"?gamepassword=test  -seekfreeloadingserver
Sadly, the parts with the quotations cause issues, like this one:

?CloudDir="Cloud1" continues to take a couple of characters from ?ServerName"My Cool Home Server". Specifically, it ends with the following error:

Code: Select all

[0006.42] Log: UCloudStorageBase::QueryForCloudDocuments ..\..\CAGGame\Cloud1?ServerName=My\
How would I have to modify this bash script to have it working properly?

Cheers,

Maxunit
User avatar
olivierfrdierick
Level 5
Level 5
Posts: 258
Joined: Thu Sep 13, 2012 12:09 pm

Re: Need help with escaping characters in a WINE Shell scrip

Post by olivierfrdierick »

Code: Select all

command option="value with space" otheroption
This example shows an argument that will be incorrectly parsed due to quotation marks not being the first and last characters.
The arguments above will be interpreted as:
argument 1: option="value
argument 2: with
argument 3: space"
argument 4: otheroption
The proper way to handle this is to escape the quotation marks that are part of the argument and enclose the entire argument between quotation marks.

Code: Select all

command "option=\"value with space\"" otheroption
This will be interpreted as:
argument 1: option="value with space"
argument 2: otheroption
You may have to escape other special characters in the quoted argument.
Or,

Code: Select all

command 'option="value with space"' otheroption
This second syntax might also be used if the argument does not contain apostrophes and does not need any environment variable substitution.

The manual of your shell environment is a good place to look to see if it supports those syntaxes.

p.s. This issue concerns shell usage and is not related to WINE. If you need more help about this you should seek help on the forums of your distro.
Locked