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

  • SEARCH
  • Home
  • 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 31383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T13:35:46+00:00 2026-05-10T13:35:46+00:00

The following shell script takes a list of arguments, turns Unix paths into WINE/Windows

  • 0

The following shell script takes a list of arguments, turns Unix paths into WINE/Windows paths and invokes the given executable under WINE.

#! /bin/sh  if [ '${1+set}' != 'set' ] then    echo 'Usage; winewrap EXEC [ARGS...]'   exit 1 fi  EXEC='$1' shift  ARGS=''  for p in '$@'; do   if [ -e '$p' ]   then     p=$(winepath -w $p)   fi   ARGS='$ARGS '$p'' done  CMD='wine '$EXEC' $ARGS' echo $CMD $CMD 

However, there’s something wrong with the quotation of command-line arguments.

$ winewrap '/home/chris/.wine/drive_c/Program Files/Microsoft Research/Z3-1.3.6/bin/z3.exe' -smt /tmp/smtlib3cee8b.smt Executing: wine '/home/chris/.wine/drive_c/Program Files/Microsoft Research/Z3-1.3.6/bin/z3.exe' '-smt' 'Z: mp\smtlib3cee8b.smt' wine: cannot find ''/home/chris/.wine/drive_c/Program' 

Note that:

  1. The path to the executable is being chopped off at the first space, even though it is single-quoted.
  2. The literal ‘\t’ in the last path is being transformed into a tab character.

Obviously, the quotations aren’t being parsed the way I intended by the shell. How can I avoid these errors?

EDIT: The ‘\t’ is being expanded through two levels of indirection: first, '$p' (and/or '$ARGS') is being expanded into Z:\tmp\smtlib3cee8b.smt; then, \t is being expanded into the tab character. This is (seemingly) equivalent to

Y='y\ty' Z='z${Y}z' echo $Z 

which yields

zy\tyz 

and not

zy  yz 

UPDATE: eval '$CMD' does the trick. The ‘\t‘ problem seems to be echo’s fault: ‘If the first operand is -n, or if any of the operands contain a backslash ( ‘\’ ) character, the results are implementation-defined.’ (POSIX specification of echo)

  • 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. 2026-05-10T13:35:47+00:00Added an answer on May 10, 2026 at 1:35 pm

    I you do want to have the assignment to CMD you should use

    eval $CMD

    instead of just $CMD in the last line of your script. This should solve your problem with spaces in the paths, I don’t know what to do about the ‘\t’ problem.

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

Sidebar

Related Questions

I'm trying to convert the following unix shell script to windows: for strWorkerDirectory in
I use the following Bash Shell script to list the .txt files recursively under
I have been trying to execute the following UNIX shell script which is not
I am wondering is there any way to execute following shell script, which waits
I have a shell script file (run.sh) that contains the following: #!/bin/bash %JAVA_HOME%/bin/java -jar
The following contents are in a file.i use a shell script to call a
I came across this shell script for OSX and I don't understand the following:
I am trying to write a shell script to simulate the following problem: File
Say for example you had a shell script that utilises inotifywait in the following
I have the following shell script and want to change the filename db_backup.sql to

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.