This is because fish only separates output on newline characters, rather
than using bash's curious IFS scheme. The solution? Replace your desired
field separators with newlines, which fish will then happily split.

> g++ (pkg-config --cflags --libs gtk+-2.0 | sed 's/\s\+/\n/g') test.cpp

This can require more elaborate treatment if the delimiter to replace
can be escaped (such as filenames with escaped spaces), but the output
from pkg-config is thankfully free of that.

On Tue, Nov 18, 2014 at 05:45:29PM -0500, Dan Anderson wrote:
> Attemping to run pkg-config as part of a build:
> 
> ```
> g++ (pkg-config --cflags --libs gtk+-2.0) test.cpp
> g++: error: unrecognized command line option ‘-pthread 
> -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include 
> -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo 
> -I/usr/include/pixman-1 -I/usr/include/libdrm 
> -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 
> -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 
> -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 
> -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 
> -I/usr/include/libpng16 -I/usr/include/harfbuzz -lgtk-x11-2.0 
> -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 
> -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 
> -lfontconfig -lfreetype ’
> ```
> 
> Expected behaviour is to expand the output of `(pkg-config)` and pass 
> those flags to `g++`, but it seems that the subcommand output is being 
> quoted. Works under bash (with backticks).
> 
> Any way to dequote?
> 
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to