From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22306 invoked by alias); 16 May 2012 11:48:27 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17085 Received: (qmail 5007 invoked from network); 16 May 2012 11:48:25 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at spf.messagingengine.com designates 66.111.4.25 as permitted sender) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=mm.st; h= message-id:from:to:mime-version:content-transfer-encoding :content-type:subject:date; s=mesmtp; bh=IqoCLLat3tN4qf7usuAz8hs woDM=; b=TkriKxGefqNr0+AmH8ICsEfoq/e+zKUaL9hxIyxxepFBBzjyVavkcmS qQX4By3YkG+M9XTvJW/v2fvdPMBMpmYw1k2eFGBy5uA55ZMUSYVuGAPZqg9lpbp1 84wBW0RXV5EhJMt8WtQIFM2YhoYJY4i+NtkJi8G13J7UhaVLCCac= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:subject:date; s=smtpout; bh=IqoCLLat3tN4qf7usuAz8hswoDM=; b=Q2gJOipGi074fCTJXq9VjTNEzSii sCvzd/+KLXQ4FFxT5fnvgc4DiyLuwqLMm3e3mIYILuTa1vWvM1hL46iE8YDiv60b amHwdty02w5wKl9juOukNqN7BPkmZrwvQsSTfSy/drwZAsUsOVD1r+V7+GYiu4yZ T2/yXGzRFNHgyNw= Message-Id: <1337168593.11208.140661076258453.20FF80E5@webmail.messagingengine.com> X-Sasl-Enc: kz6MCrC4XVf0uXd3Bu7PAJXZis5d/prjVTaAX7SZ45jH 1337168593 From: Ronald Fischer To: zsh-users@zsh.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface Subject: global aliases substituting *within* a path Date: Wed, 16 May 2012 13:43:13 +0200 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 + 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)