On Tue, Feb 18, 2020 at 10:16:38PM +1300, Mike Taves wrote: > On Tue, 18 Feb 2020 at 20:22, Sandro Santilli <s...@kbt.io> wrote: > > > properly escape a path. While I see there is also /usr/bin/printf I'm > > > not sure how common or standard this tool is (my tests with /bin/sh > > > didn't go well, so I opted to switch to Bash for reliability). > > > > GNU coreutils "printf" works fine here: > > > > [strk@liz:~] /usr/bin/printf "%q\n" "space 'quote' and \"doublequote\"" > > 'space '\''quote'\'' and "doublequote"' > > [strk@liz:~] /usr/bin/printf --version | head -1 > > printf (GNU coreutils) 8.28 > > The printf function in Bash has supported the %q directive for much longer > https://stackoverflow.com/a/26069697 > https://web.archive.org/web/20031119043100/http://www.gnu.org/software/bash/manual/bashref.html > > whereas the %q directive for /usr/bin/printf was introduced a few > years ago, and seems to produce a different output, for example having > a single quotation mark on either end of the above example. Bash's > printf does not add single quotation marks to the output, as it is in > a format that can be reused as shell input.
Do you have a use case for avoiding the single quotation mark from the output of geos-config ? Few-years-ago dependency could be fine, given GEOS requires C++10 now, or we could just use quotes and allow for spaces in path names (while still forbidding quotes and dollars etc. ?) Do you have examples of paths you need to support ? --strk; _______________________________________________ geos-devel mailing list geos-devel@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/geos-devel