linusg linusg - 4 months ago 7x
Bash Question

Cross-platform, save to use command line string separator

For a new feature in

, we need a command line option recieving 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? Thanks in advance!


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

  • Windows: ;

  • Unix: :

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