On 02/19/11 12:45, weakish wrote: > In fish's user doc (section "Combining different expansions"): > >> When combining multiple parameter expansions, expansions are performed >> in the following order: >> >> * Command substitutions >> * Variable expansions > > So command substitutions get performed before variable expansions? > > But give fish the following code: > > echo $(echo HOME) > > fish said: > > echo $(echo HOME) > ^ > > It seems variable expansion happens first here?
Well, parsing happens first, and prevents the above (As it turns out, $ can syntactically only accept literal variable names (and whatever else it specifically accepts)). (At least, that's how a sane shell might do it. I don't trust fish's parsing enough to be certain.) Anyway, command substitution and variable expension probably don't happen in a fixed order relative to each other. If you have (cat $variable) then the variable has to be expanded before the command is executed, obviously. On the other hand $SomeArray[(seq 3)] clearly has to execute the command before expanding the variable. -Isaac ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Fish-users mailing list Fish-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fish-users