On Mon, Sep 19, 2011 at 1:47 AM, Robert Shinka <k...@unknownlayer.net> wrote:
> On Sun, Sep 18, 2011 at 09:20:21PM +0200, Jan Kanis wrote:

>>  Bash treats command substitution and variable expansion as a list of
>>  whitespace separated tokens. It also includes escapes to treat both as a
>>  single token, in case you don't want the default behaviour.
>>
>>  Fish does the same for variables, except it doesn't split the contents when
>>  the variable is used, but it stores the tokens in a structured way as an
>>  array. Command substitution works a bit differently. Maintaining a 
>> structured
>>  form of data like with variables isn't possible because it is output from
>>  arbitrary commands, so fish splits the command output like bash does, but 
>> only
>>  on newlines. However fish doesn't provide a way to prevent the splitting.
>
> If fish reconstructed "$var" the same way it split it (with \n), then
> your problem wouldn't exist. You could work with lines as usual with
> $var, and "$var" would produce the exact data it was created with.
> If anyone needed a space-separated version of the string for whatever
> reason, they could trivially do so with echo or tr, but I think that's a
> rare case. Right now, there's no reasonable utility.

Yes, that would be more logical. But separating with spaces saves
screen space when printing the array, which is quite a common
operation.

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the 
BlackBerry&reg; mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry&reg; DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1 
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to