Re: Ignored alias inside for loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 26, 2015 at 04:09:12PM +0000, Rusty Bird wrote:
> > Aliases are expanded during parsing, not during execution (like 
> > functions are). The for loop is parsed completely before it is
> > executed.

> Ah, what confused me was that I wrongly remembered it working inside
> an if (instead of for) block. But looking again now, only the alias
> *definition* was inside.

> > Using a function instead of an alias, or using eval will do what
> > you want.

> Do you mean replacing the line with: eval "alias foobarbaz='echo ok'"
> That doesn't seem to work either (in dash or bash).

eval foobarbaz

This may not be practical since it needs to be done for every alias use.

-- 
Jilles Tjoelker
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux