Re: [Fish-users] `` vs ()

2016-12-13 Thread John Chludzinski
On Fedraa 25,  this works fine:

gcc (pkg-config --cflags gtk+-3.0 | string split ' ') (pkg-config --libs
gtk+-3.0 | string split ' ') 

On RHEL 6.7 this was required:

gcc (*pkg-config --cflags gtk+-2.0 |* string trim | string split ' ')
(pkg-config --libs gtk+-2.0 | string trim | string split '  ') 

---for whatever reason "pkg-config --cflags gtk+-2.0" adds space at the end?


On Mon, Dec 12, 2016 at 5:38 PM, Kurtis Rader  wrote:

> On Mon, Dec 12, 2016 at 2:31 PM, John Chludzinski <
> john.chludzin...@gmail.com> wrote:
>
>> On the Bourne shell I  can use:
>>
>> sh-4.1$ gcc `pkg-config gtk+-2.0 --cflags` `pkg-config gtk+-2.0 --libs`
>> dbuscomm.c
>>
>>
>> When I try (in Fish):
>>
>> > gcc (pkg-config gtk+-2.0 --cflags) (pkg-config gtk+-2.0 --libs)
>> dbuscomm.c
>>
>> I get a whole bunch of bogus compile errors.
>>
>> Why?
>>
>
> It's because POSIX shells like bash split the subcommand output on
> whitespace while fish only splits on newlines. Since `pkg-config gtk+-2.0
> --cflags` produces a single line of output fish passes that as a single
> argument (i.e., a single string) to gcc which is understandably confused.
> See https://github.com/fish-shell/fish-shell/issues/1947 and
> https://github.com/fish-shell/fish-shell/issues/2568 and
>
> http://stackoverflow.com/questions/28128669/fish-
> command-substitution-doesnt-work-like-in-bash-or-zsh/28129450#28129450
>
> However, rather than using `tr` as suggested in that SO thread I would
> recommend using the `string split` builtin.
>
> --
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>
--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users


Re: [Fish-users] `` vs ()

2016-12-12 Thread Kurtis Rader
On Mon, Dec 12, 2016 at 2:31 PM, John Chludzinski <
john.chludzin...@gmail.com> wrote:

> On the Bourne shell I  can use:
>
> sh-4.1$ gcc `pkg-config gtk+-2.0 --cflags` `pkg-config gtk+-2.0 --libs`
> dbuscomm.c
>
>
> When I try (in Fish):
>
> > gcc (pkg-config gtk+-2.0 --cflags) (pkg-config gtk+-2.0 --libs)
> dbuscomm.c
>
> I get a whole bunch of bogus compile errors.
>
> Why?
>

It's because POSIX shells like bash split the subcommand output on
whitespace while fish only splits on newlines. Since `pkg-config gtk+-2.0
--cflags` produces a single line of output fish passes that as a single
argument (i.e., a single string) to gcc which is understandably confused.
See https://github.com/fish-shell/fish-shell/issues/1947 and
https://github.com/fish-shell/fish-shell/issues/2568 and

http://stackoverflow.com/questions/28128669/fish-command-substitution-doesnt-work-like-in-bash-or-zsh/28129450#28129450

However, rather than using `tr` as suggested in that SO thread I would
recommend using the `string split` builtin.

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank
--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users


[Fish-users] `` vs ()

2016-12-12 Thread John Chludzinski
On the Bourne shell I  can use:

sh-4.1$ gcc `pkg-config gtk+-2.0 --cflags` `pkg-config gtk+-2.0 --libs`
dbuscomm.c


When I try (in Fish):

> gcc (pkg-config gtk+-2.0 --cflags) (pkg-config gtk+-2.0 --libs) dbuscomm.c

I get a whole bunch of bogus compile errors.

Why?
--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users