GNOME Bugzilla – Bug 637414
Command Line parsing problem
Last modified: 2018-06-29 22:49:31 UTC
In bug 629712, it was found that using the command line to update commodity prices will fail if the file name includes white space. Thus, /Applications/Gnucash.app/Contents/MacOS/Gnucash --add-price-quotes /path/to/my/data/file/My Accounts will fail, although /Applications/Gnucash.app/Contents/MacOS/Gnucash --add-price-quotes /path/to/my/data/file/MyAccounts will work.
What about: /Applications/Gnucash.app/Contents/MacOS/Gnucash --add-price-quotes /path/to/my/data/file/My\ Accounts or /Applications/Gnucash.app/Contents/MacOS/Gnucash --add-price-quotes "/path/to/my/data/file/My Accounts" The whitespace issue is a fundamental aspect of the command-line parser in the shell/terminal itself (it's already broken apart into separate "words" well before Gnucash even starts up).
Well, yes and no. It certainly doesn't help that the string is passed to the shell twice, once on the command line and once by the launcher script. It should be possible to concoct some combination of quoting and escaping that gets the right string presented to the parser in Gnucash (which is GOptionContext). So far neither David nor I have succeeded in doing so. It does work fine with Linux, where there's only one layer of shell.
Daniel--neither of those methods works here. I tried (I noted this on bug 629712)
It seems the trick is to use single quotes: /Applications/Gnucash.app/Contents/MacOS/Gnucash --add-price-quotes '/path/to/my/data/file/My Accounts' Works for me with 2.5.4.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=637414. Please update any external references or bookmarks.