This got me at first too. Command substitution returns a *list*, not just a
string. When you prefix a list with a string ("http://";), that string is
prefixed onto each member of the list:

$ function tmp; echo 1; echo 2; echo 3; end
$ echo "foo"(tmp)
foo1 foo2 foo3

If the list is empty, the string is prefixed onto nothing, hence the empty
output.

Your "vip" function must be returning nothing. What does this return:
printf ">%s<\n" (vip)


On Wed, Aug 20, 2014 at 9:54 AM, Rickard von Essen <
rickard.von.es...@gmail.com> wrote:

> What is strange is that
> $ echo "http://";(vip)
> outputs only a new line. I would expect it to at least printout:
> http://
>
> // Rickard
>
>
> On Wed, Aug 20, 2014 at 3:27 PM, Stestagg <stest...@gmail.com> wrote:
>
>> My guess would be something to do with how stdout is being
>> captured/ssh/vagrant weirdness
>>
>> It might be worth trying adding -T or -t to the ssh command to
>> force/unforce ssh from using pty allocation
>>
>>
>>
>>
>> On Wed, Aug 20, 2014 at 2:19 PM, Rickard von Essen <
>> rickard.von.es...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> It turns out that is the function creating the url that is not working
>>> as I expected. This is the actual code:
>>>
>>> function vip
>>>   vagrant ssh $argv[1] -c "ifconfig eth1 | sed -ne 's/.*inet
>>> addr:\(\S*\)\s*Bcast.*/\1/p'" \
>>>     ^ /dev/null
>>> end
>>>
>>> Using it gives:
>>> $ vip
>>> 192.168.233.170
>>>
>>> But running:
>>> $ open "http://";(vip)
>>> Usage: open [-e] [-t] [-f] [-W] ...
>>>
>>> Any ideas?
>>>
>>> // Rickard
>>>
>>>
>>> On Wed, Aug 20, 2014 at 2:19 PM, Cedric Auger <sedri...@gmail.com>
>>> wrote:
>>>
>>>> Works perfectly for me:
>>>> -----------------------------
>>>> Welcome to fish, the friendly interactive shell
>>>> Type help for instructions on how to use fish
>>>> cauger@cauger-PNR ~> function url
>>>>                            echo "some url"
>>>>                      end
>>>> cauger@cauger-PNR ~> open (url)/index.html
>>>> xdg-open: file 'some url/index.html' does not exist
>>>> cauger@cauger-PNR ~>
>>>> ----------------------------
>>>> Have you tried to run it in some interactive shell, in a script or
>>>> somewhere else?
>>>>
>>>>
>>>>
>>>> 2014-08-20 13:14 GMT+02:00 Rickard von Essen <
>>>> rickard.von.es...@gmail.com>:
>>>>
>>>>> Hi,
>>>>>
>>>>> If i have a function that computes an URL, say:
>>>>>
>>>>> function url
>>>>>   echo "some url"
>>>>> end
>>>>>
>>>>> Then I want to use it in a command substitution. Something like:
>>>>>
>>>>> open (url)/index.html
>>>>>
>>>>> but (url) is expanded to empty string. How should I do this?
>>>>>
>>>>> Regards
>>>>> Rickard von Essen
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Slashdot TV.
>>>>> Video for Nerds.  Stuff that matters.
>>>>> http://tv.slashdot.org/
>>>>> _______________________________________________
>>>>> Fish-users mailing list
>>>>> Fish-users@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/fish-users
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> .../Sedrikov\...
>>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Slashdot TV.
>>> Video for Nerds.  Stuff that matters.
>>> http://tv.slashdot.org/
>>> _______________________________________________
>>> Fish-users mailing list
>>> Fish-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/fish-users
>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> 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

-- 


--



------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to