I would avoid using eval for this, since the goal is merely to split
a string. fish already splits output by newlines (as if IFS=\n), so
> docker (./machine config prl | tr \ \t \n) ps
is sufficient to mimic IFS=\n\ \t

Why? eval will fully interpret the output, expanding variables and
executing subcommands. For instance, consider the following:
> function same; for a in $argv; same $a; end; end
> same (same '(date) $PATH')
(date) $PATH
> same (same '(date) $PATH' | tr \ \t \n)
(date)
$PATH
> eval same (same '(date) $PATH')
Thu Jan 29 16:24:41 PST 2015
/home/keii/.local/bin
/bin
/usr/bin

The latter behavior could be surprising (and a security risk).

On Mon, Jan 26, 2015 at 10:28:50PM +0100, Rickard von Essen wrote:
>    To summarize the solution, this works:
>    eval docker (./machine config prl) ps
>    // Rickard
>    On Sat, Jan 24, 2015 at 6:07 PM, Glenn Jackman <[1]jack...@pythian.com>
>    wrote:
> 
>      I realized shortly after I posted that fish will probably treat the
>      result of a command substitution as a single element (fish splits the
>      output of the cmd subst into elements on newlines). You will need to
>      `eval` the command
>      Glenn Jackman | Software Developer
>      Pythian
>      Tel: [2]+1 613 565 8696 Ext. 1478
>      Cell: [3]+1 613 808 4984
>      Email: [4]jack...@pythian.com
> 
>    --------------------------------------------------------------------------
> 
>      From: Rickard von Essen <[5]rickard.von.es...@gmail.com>
>      Date: Sat, 24 Jan 2015 17:37:44 +0100
>      To: <[6]jack...@pythian.com>
>      Cc: fish-users<[7]fish-users@lists.sourceforge.net>
>      Subject: Re: [Fish-users] Using subshells to expand arguments
> 
>      Tried that and it did not work, if remember correctly fish sometimes put
>      subshells in the background.
> 
>      On Jan 24, 2015 5:00 PM, "Glenn Jackman" <[8]jack...@pythian.com> wrote:
> 
>        Command substitution in fish uses plain parentheses without the
>        leading dollar
> 
>        docker (./machine config prl) ps
>        Glenn Jackman | Software Developer
>        Pythian
>        Tel: [9]+1 613 565 8696 Ext. 1478
>        Cell: [10]+1 613 808 4984
>        Email: [11]jack...@pythian.com
> 
>        -----Original Message-----
>        From: Rickard von Essen <[12]rickard.von.es...@gmail.com>
>        Date: Sat, 24 Jan 2015 15:40:43
>        To: fish-users<[13]fish-users@lists.sourceforge.net>
>        Subject: [Fish-users] Using subshells to expand arguments
> 
>        
> ------------------------------------------------------------------------------
>        New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
>        GigeNET is offering a free month of service with a new server in
>        Ashburn.
>        Choose from 2 high performing configs, both with 100TB of bandwidth.
>        Higher redundancy.Lower latency.Increased capacity.Completely
>        compliant.
>        [14]http://p.sf.net/sfu/gigenet
> 
> References
> 
>    Visible links
>    1. mailto:jack...@pythian.com
>    2. file:///tmp/tel:%2B1%20613%20565%208696%20Ext.%201478
>    3. file:///tmp/tel:%2B1%20613%20808%204984
>    4. mailto:jack...@pythian.com
>    5. mailto:rickard.von.es...@gmail.com
>    6. mailto:jack...@pythian.com
>    7. mailto:fish-users@lists.sourceforge.net
>    8. mailto:jack...@pythian.com
>    9. file:///tmp/tel:%2B1%20613%20565%208696%20Ext.%201478
>   10. file:///tmp/tel:%2B1%20613%20808%204984
>   11. mailto:jack...@pythian.com
>   12. mailto:rickard.von.es...@gmail.com
>   13. mailto:fish-users@lists.sourceforge.net
>   14. http://p.sf.net/sfu/gigenet

> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/

> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to