bashargumentsgnu

What does `bash --dump-po-strings` do?


in GNU bash manual reference (section 6.1 : Invoking bash) there are some option, two of them are as follows:

--dump-po-strings A list of all double-quoted strings preceded by $ is printed on the standard output in the GNU gettext PO (portable object) file format. Equivalent to -D except for the output format.

--dump-strings Equivalent to -D.

But I don't understand their meaning. I also searched about them, unfortunately I didn't find an example.

Can anybody explain them with an example? Thanks.


Solution

  • Given script.sh:

    #!/bin/bash
    echo $"text"
    

    --dump-po-strings outputs format for creating translations. https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html

    $ bash --dump-po-strings script.sh
    #: script.sh:2
    msgid "text"
    msgstr ""
    

    --dump-strings just outputs the strings inside $"this".

    $ bash --dump-strings script.sh
    "text"