linusg linusg - 5 months ago 12
Bash Question

Cross-platform, safe to use command line string separator

For a new feature in

, we need a command line option receiving a string with any separator in it. Here's the discussion:


pyinstaller --add-data="file.txt?dir"

is the separator here, this should be another character. It's not guaranteed, that the string is quoted!

We've thought about
; : > < | *
and so on, but we can't figure out what character would be save to use, without side effects and platform independent (and hopefully not allowed in paths).
e.g will redirect stdout,
is the command separator on POSIX ect.

Any ideas what character we can use?


The best solution for us was using a platform depependent separator:

  • Windows: ;

  • Unix: :

A bit tricky to document, but a clean and save solution.