separate output with newlines for fish shell
Submitted by David Adam
Assigned to pkg..@..op.org
While POSIX shells split their command substitutions into tokens based on whitespace, fish uses only newlines by default.
That is, the following are equivalent:
echo some args
(fish) c++ (echo some; echo args)
This has been a deliberate design decision to avoid the problems with files containing embedded spaces and so on. Obviously it is still not resistant to embedded newlines but that is the tradeoff that has been made.
So, in fish, the current "best" method of using pkg-config is:
c++ (pkg-config --cflags somepkg | tr ' ' '\n')
I'd like to improve this situation. The options I can see, in decreasing order of personal preference, are:
- Have pkg-config produce its output for --cflags etc. newline-delimited (possibly iff $SHELL = fish)
- Ship a small wrapper with fish that adjusts the output in a relatively conservative way (only in command substitutions)
- Document the change required in the FAQ and leave it at that
Would you take a patch that does the first?