Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

global aliases substituting *within* a path



I have a set of directory structures like this:

aaa/foo/bar/baz/xxx
bbb/foo/bar/baz/yyy
ccc/foo/bar/baz/zzz
etc.

I'm looking for a way to make typing easier on the command line, in
order to not have to type foo/bar/baz all the time.

Of course I can achieve this by setting a shell variable in my .zshrc:

X=foo/bar/baz

Then I can do for instance

  ls aaa/$X/xxx

Now I recently learned about global aliases, which permit alias
substitution to be done within the command line, and I thought that I
maybe could use this. Here was my (failed) attempt:

alias -g X=foo/bar/baz

# Does NOT work at hoped
ls aaa/X/xxx

X is not substituted, because it is not a word on its own (not
surrounded by spaces).

My question: For my problem, do I have to stick with my original
solution (shell variable), or is it a way to do it with aliases, or is
there maybe an even more clever way to achieve my goal?

Ronald
-- 
Ronald Fischer <ronaldf@xxxxxx>
+  If a packet hits a pocket on a socket on a port, 
+  and the bus is interrupted and the interrupt's not caught,
+  then the socket packet pocket has an error to report.
+		(cited after Peter van der Linden)



Messages sorted by: Reverse Date, Date, Thread, Author