Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7585439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:10:36+00:00 2026-05-30T19:10:36+00:00

I have a complex script that takes variables from files and uses them to

  • 0

I have a complex script that takes variables from files and uses them to run programs (Wine specifically)

Passing options from the variables in the other file isn’t working as expected:

#!/bin/bash
. settingsfile
wine $run

And in the other file:

run="run.exe -withoption \"This text\""

When I change wine $run to echo wine $run, it echos a string, which when run explicitly works fine:

#!/bin/bash
. settingsfile
wine run.exe -withoption "This text"

Edit: Running with #!/bin/bash -x shows me:

+ wine run.exe -withoption '"This' 'text"'

How do I fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:10:38+00:00Added an answer on May 30, 2026 at 7:10 pm

    The problem is that "This and text" are treated as separate arguments, each containing a double-quote, rather than as a single argument This text. You can see this if you write a function to print out one argument per line; this:

    function echo_on_separate_lines ()
    {
      local arg
      for arg in "$@" ; do
        echo "<< $arg >>"
      done
    }
    run="run.exe -withoption \"This text\""
    echo_on_separate_lines $run
    

    prints this:

    << run.exe >>
    << -withoption >>
    << "This >>
    << text" >>
    

    rather than this:

    << run.exe >>
    << -withoption >>
    << This text >>
    

    The simplest solution is to tack on an eval to re-process the quoting:

    run="run.exe -withoption \"This text\""
    wine $run     # or better yet:   wine "$run"
    

    But a more robust solution is to have run be an array, and then you can refer to it as "${run[@]}":

    run=(run.exe -withoption "This text")
    wine "${run[@]}"
    

    so that the quoting is handled properly from the get-go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a complex Powershell script that gets run as part of a SQL
I have a complex command that I'd like to make a shell/bash script of.
I currently have a PowerShell script that is used for complex automated Exchange mailbox
If I have a script that handles state information that's a bit more complex
I have a complex Gradle script that wraps up a load of functionality around
We sometimes write dataport scripts that rename tables or columns and have other complex
I have a complex .NET Remoting server app that provides a couple of services.
I have some complex stored procedures that may return many thousands of rows, and
I have one piece of Cocoa code I wrote that takes in an XML
I have a particular page that uses lots of widgets that have to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.