zsh-users
 help / color / mirror / code / Atom feed
From: "Manuel Presnitz" <mpy@gmx.net>
To: "Ronald Fischer" <ynnor@mm.st>, zsh-users@zsh.org
Subject: Re: global aliases substituting *within* a path
Date: Wed, 16 May 2012 14:40:13 +0200	[thread overview]
Message-ID: <201205161440130167.00B866E0@mail.gmx.net> (raw)
In-Reply-To: <1337168593.11208.140661076258453.20FF80E5@webmail.messagingengine.com>

Not an answer to your questions, but also quite handy sometimes:

$ ls aaa/**/xxx

Manuel.
 
 
 
Ronald Fischer hat am 16.05.2012 um 13:43 folgendes geschrieben:

> 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@eml.cc>
> +  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)




  parent reply	other threads:[~2012-05-16 12:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-16 11:43 Ronald Fischer
2012-05-16 12:17 ` Valodim Skywalker
2012-05-16 12:40 ` Manuel Presnitz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-18 13:08 Ronald Fischer
2012-05-21 17:54 ` Bart Schaefer
2012-05-16 11:41 Ronald of Steiermark

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=201205161440130167.00B866E0@mail.gmx.net \
    --to=mpy@gmx.net \
    --cc=ynnor@mm.st \
    --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).