From e5061bcda1d37e7858328bf3a37d5a6bff9fa53f Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 8 Nov 2020 13:40:00 +0100 Subject: [PATCH] docs: Use `string split -n` for pkg-config It can in some cases give a trailing space, which causes us to return an empty element. Fixes #7465. --- doc_src/faq.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc_src/faq.rst b/doc_src/faq.rst index c1eca48aa..32b6afbe5 100644 --- a/doc_src/faq.rst +++ b/doc_src/faq.rst @@ -196,9 +196,11 @@ In the overwhelming majority of cases, splitting on spaces is unwanted, so this However sometimes, especially with ``pkg-config`` and related tools, splitting on spaces is needed. -In these cases use ``string split " "`` like:: +In these cases use ``string split -n " "`` like:: - g++ example_01.cpp (pkg-config --cflags --libs gtk+-2.0 | string split " ") + g++ example_01.cpp (pkg-config --cflags --libs gtk+-2.0 | string split -n " ") + +The ``-n`` is so empty elements are removed like POSIX shells would do. How do I get the exit status of a command? ------------------------------------------