On Mon, Apr 5, 2010 at 23:02, Beni Cherniavsky-Paskin <[email protected]> wrote:
>
> 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 conistency argument wins: the "all expansions work in
> double quotes" rule is trivial to remember, anything else isn't.
>
Wait, I'm lying here about consistency.
I want various expansions to work inside double quotes, but I mean
*different* things by "work":
- "(PROGRAM)" should return the output in *one* word, as-is without
any splitting.
- "fil?name w*th spaces" should (if at all) expand to *separate* words
for each name.
This is strange, but other behaviors would be useless.
- "$var" expands to one word, *joining* the values of $var with spaces.
That's what everybody expects.
OK, let's see which simple consistent rule(s) can be made for
expansion in quotes.
- All shells I know of guarantee that "..." always means to a single word.
This is a good promise to keep.
This means that "foo $onetwothree bar" must expand to "foo 1 2 3 bar",
not "foo 1 bar" "foo 2 bar" "foo 3 bar".
- Fish mostly guarantees that all expansions behave similarly to brace
expansion:
$onetwothree == (seq 3) == {1,2,3}
Can we extend this to remain true inside quotes?
The "(PROGRAM)" wish is valid - we want to get the original output,
as-is, in one word.
"foo (seq 3) bar" should expand to "foo 1 2 3 bar" too.
Brace expansion should work inside quotes.
"foo {1,2,3} bar" should also expand to "foo 1 2 3 bar".
This is nearly useless, but helpful for the "foo{$array}bar" pattern
(-> "foo1 2 3bar").
So the globbing idea was silly, and the other expansions are not
really useful inside quotes.
--
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