Also relevant,

   - from the tutorial: "Unlike other shells, variables are not further
   split after substitution"
   - from the design: "Everything that can be done in other shell languages
   should be possible to do in fish, though fish may rely on external commands
   in doing so"

So, consider command substitution to return an array of lines, and these
lines won't be split into words unless you really really want them to be.


On Thu, Feb 18, 2016 at 10:49 AM, Glenn Jackman <jack...@pythian.com> wrote:

> This is as much as the documentation says about it: "If the output is
> more than one line long, each line will be expanded to a new parameter.
> Setting IFS to the empty string will disable line splitting."
>
> I'm guessing this fits in with the "law of orthogonality" (
> http://fishshell.com/docs/current/design.html)
>
> One way to get the result you want without eval would be
>
>     gcc -o snmpdemoapp snmpdemoapp.o (net-snmp-config --libs | tr -s
> '[:space:]' '\n')
>
> That way, each word comes out on a separate line
>
>
> On Thu, Feb 18, 2016 at 10:33 AM, John Chludzinski <
> john.chludzin...@gmail.com> wrote:
>
>> That indeed works but WHY?
>>
>> On Thu, Feb 18, 2016 at 10:23 AM, Glenn Jackman <jack...@pythian.com>
>> wrote:
>>
>>> I *think* what's happening is the sh version with backticks will split
>>> the result of the backticked command into *words*, while fish will split
>>> the result into *lines*. So you're handing gcc the argument "-z relro -WI"
>>> instead of "-z" "relro" "-WI", etc.
>>>
>>> You might try, and this is a guess,
>>>
>>>     eval gcc -o snmpdemoapp snmpdemoapp.o (net-snmp-config --libs)
>>>
>>>
>>> On Thu, Feb 18, 2016 at 10:15 AM, John Chludzinski <
>>> john.chludzin...@gmail.com> wrote:
>>>
>>>> When I try to compile some SNMP code there's an inline command I need
>>>> to get the required libs. When I run the command in fish, using () I get
>>>> the following:
>>>>
>>>> gcc -o snmpdemoapp snmpdemoapp.o (net-snmp-config --libs)
>>>>
>>>> /usr/bin/ld: warning: -z relro -Wl ignored.
>>>> /usr/bin/ld: warning: -z now -L/usr/lib -lnetsnmp -lssl -lssl -lcrypto
>>>> -lm ignored.
>>>> snmpdemoapp.o: In function `main':
>>>> /home/jski/amp-v-e-switch/vis/snmp/snmpdemoapp.c:28: undefined
>>>> reference to `init_snmp'
>>>> ...
>>>> pdemoapp.c:101: undefined reference to `snmp_perror'
>>>> /home/jski/amp-v-e-switch/vis/snmp/snmpdemoapp.c:89: undefined
>>>> reference to `snmp_sess_perror'
>>>> collect2: error: ld returned 1 exit status
>>>>
>>>>
>>>>
>>>> When I used Bourne, it works:
>>>>
>>>> gcc -o snmpdemoapp snmpdemoapp.o `net-snmp-config --libs`
>>>>
>>>> Why?
>>>>
>>>> ---John
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>>>> Monitor end-to-end web transactions and take corrective actions now
>>>> Troubleshoot faster and improve end-user experience. Signup Now!
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>>>> _______________________________________________
>>>> Fish-users mailing list
>>>> Fish-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/fish-users
>>>>
>>>>
>>>
>>>
>>> --
>>> *Glenn Jackman*
>>> Senior Software Developer
>>>
>>> *Pythian - Love your data*
>>> jack...@pythian.com
>>> Tel: +1 613 565 8696 Ext. 1478
>>> Mobile: +1 613 808 4984
>>> www.pythian.com
>>>
>>> --
>>>
>>>
>>>
>>>
>>
>
>
> --
> *Glenn Jackman*
> Senior Software Developer
>
> *Pythian - Love your data*
> jack...@pythian.com
> Tel: +1 613 565 8696 Ext. 1478
> Mobile: +1 613 808 4984
> www.pythian.com
>



-- 
*Glenn Jackman*
Senior Software Developer

*Pythian - Love your data*
jack...@pythian.com
Tel: +1 613 565 8696 Ext. 1478
Mobile: +1 613 808 4984
www.pythian.com

-- 


--



------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to