Skip to content

Voodoo double quotes

Franco Corbelli edited this page Sep 15, 2023 · 2 revisions

Use the double quotes, especially on *nix systems!

and even more when using wildcard characters such as * and ?

Some examples

  • GOOD zpaqfranz a "/tmp/test_???" /whatever -only "*.cpp"
  • GOOD zfsadd /tmp/kong.zpaq "tank/d@2021" "--60d"
  • GOOD "test_????.zpaq"
  • BAD test_????.zpaq
  • GOOD "*francia*"
  • BAD *francia*
  • WARN OK on Windows, but NOT on Linux zpaqfranz a z:\test_??? * -only *.cpp

Luke, in addition to using the Force, uses double quotes!


Translation

When command-line strings are entered, there are differences between Windows and *nix.

On the latter, the "explosion" of wildcards normally takes place BEFORE programs are started.

This happens because the relevant shells (bash, etc.) process parameters and pass them to the program (zpaqfranz in this case) already expanded.
Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of $, `, \

Actually, the situation is much more complex, but I don't want to go into too much detail.

In Windows, however, the parameters are passed to the program as they are.

Therefore, sometimes, you write on *nix as you would on Windows, getting different results or even wrong one.

There is a bit of heuristics inside zpaqfranz to make some commands run on *nix with the same logic as on Windows, but it is partial, precisely because the parameters arrive "pre-digested" on *nix.

Clone this wiki locally