So fish doesn't make a distinction between line separators and field
separators in IFS? I hadn't expected that, it treats \n and spaces quite
differently.

I have had the need to join array elements before, but I've always used a
strjoin-like function (but a sane variant instead of the one from my first
message, though the sane one doesn't work with \n currently). I'd say an
explicit function (possibly shipped with fish) is better/more explicit than
magic IFS trickery.

The current behaviour of joining "$var" with spaces is however a bit
arbitrary, so I'm not against having it configurable with $IFS. However I
would prefer having it join with spaces by default, somehow "$var" being a
single line string rather than a multiline is more what I would expect, and
so would bash users probably.


On Thu, Sep 22, 2011 at 00:25, Robert Shinka <k...@unknownlayer.net> wrote:

> On Wed, Sep 21, 2011 at 03:41:54PM -0400, Stestagg wrote:
> > [sorry Robert, for the direct reply]
>
> Your secret is safe with me. ;)
>
> > In bash, at least, the $IFS environment variable is used to specify
> > the characters used to split arguments into their constituent parts.
> > the $* function then uses the first character of this variable to join
> > re-join the parts.
> >
> > It wouldn't be very hard to have fish behave in the same way (if it
> > doesn't already) when joining arrays, and therefore if you want to
> > join arrays into a newline-separated string, it would just be a case
> > of temporarily ensuring that "\n" was the first character of IFS
> >
> > Steve Stagg
> > <elided>
>
> fish doesn't currently do this, despite the 'read' builtin using IFS.
> IFS is typically set to "\n\ \t", so the default would indeed be \n.
>
> I'm not opposed to this idea.
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to