Abracadalias...
Sep. 14th, 2005 07:18 pmHappened across an interesting skit which described some clever tricks, magic aliases, that make it possible to short circuit shell expansions. The basic idea is as follows:
- You have an alias which saves parts of the shell context, changes that context, and then passes the alias's arguments to a helper shell function.
- The helper shell function restores the original shell context which was saved by the alias (either before or after doing something with the arguments it was given).
- Thus, the arguments passed to the alias undergo variable and wildcard expansion in the altered shell context, and yet the running of the alias as a whole leaves the shell context as it was.
I'm not convinced that magic aliases are useful for anything, but that doesn't undermine the coolness/perversity of the idea...