From: Ronald of Steiermark <austria_rules@yepmail.net>
To: zsh-users@zsh.org
Subject: global aliases substituting *within* a path
Date: Wed, 16 May 2012 13:41:18 +0200 [thread overview]
Message-ID: <1337168478.11045.140661076254845.3C1423DA@webmail.messagingengine.com> (raw)
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 <austria_rules@yepmail.net>
There are 10 types of people in the world: those who understand binary and those who don't.
next reply other threads:[~2012-05-16 11:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-16 11:41 Ronald of Steiermark [this message]
2012-05-16 11:43 Ronald Fischer
2012-05-16 12:17 ` Valodim Skywalker
2012-05-16 12:40 ` Manuel Presnitz
2012-05-18 13:08 Ronald Fischer
2012-05-21 17:54 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1337168478.11045.140661076254845.3C1423DA@webmail.messagingengine.com \
--to=austria_rules@yepmail.net \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).