On Tue, Mar 30, 2010 at 21:35, Isaac Dupree
<[email protected]> wrote:
> oh, how odd! It looks like it turns each LF into a space character,
> (except for the final trailing LF which it deletes, as per standard for
> process-substitution operators). This leaves the CRs around to make
> stupid-looking output (in a terminal, they move the pointer to the left
> side without moving it down a line).
>
Well, CRs are generally stupid in unixland. But yes, fish should
probably strip them.
> Turning LFs into spaces is obviously a Fish bug, IMHO... (Neither of
> bash's modes (with quotes, or without them) match this fish behavior)
>
Fish intentionally does NOT conform to bash's space handling, it tries
to do better.
Bash without quotes splits words on any whitespace; for a multiline
text, that's too aggressive, so fish splits only on newlines, which is
very useful 95% of the time.
However, you are right that fish lacks a way to not split command
substitutions at all.
You can fake it with something like:
res = ''
COMMAND | while read line
set res $res$line\n
end
# now $res contains the whole output as one word
# (bug: there is a trailing newline even if the output didn't end with
newline)
but the need to do something like this is a bug - "(command)"
expansion should certainly work.
IMHO all other expansions ("%process", "~user homedir",
"{brace,expansion}", "even *wildcards*?") should work too. This is
not what other shells do, but it's useful:
- File paths with a lot of spaces are cumbersome unless you use quotes.
Globbing such paths inside double quotes would be nice.
- Brace expansion is mostly interesting for the "foo{$var}bar" pattern.
- "~user" and "%process" are less useful, and sometimes annoying.
But I'd include them for consistency.
I think the consistency argument wins: the "all expansions work in
double quotes" rule is trivial to remember, anything else isn't.
--
Beni Cherniavsky-Paskin <[email protected]>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users