From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26322 invoked by alias); 4 Dec 2013 05:23:22 -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: 18193 Received: (qmail 2529 invoked from network); 4 Dec 2013 05:23:16 -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.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=DbVLkIAW1mMvqqoSzLiHLeaagp3MUxbWYaTHldJzFCc=; b=Nef5X+jSVmDPkOskM4vcvMwDGvojlnTxF2Qv0vpqiTcD1AryBmyD1OCISOlRWx0GJL 20+qvGMHtKMAmzF9OxR8HOitChrMIruRLVw3n1h2hwe6EGrmnt03qJ6ykuwmFtBhFbw7 r3jTdZLhZOamrzhptPyU1yae5w1ADLwJy21iU7kyQxQwvWZYVMjb0+ljCawKcMmxu4Ee z34MQK8ds1P+KavJbI+zLpmSnUlX10+LxZDzbnHfjQlpSFodctBhKkCXAk4okRKu+vul PDaBDq6Fpcq1mMCQ/FU9X2YQL3o1+UZDpal3sH5vheLnKiHcw+Ym63BVyzikWzm3p9DN 9M/Q== X-Received: by 10.220.192.198 with SMTP id dr6mr8497907vcb.19.1386134592844; Tue, 03 Dec 2013 21:23:12 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: shawn wilson Date: Wed, 4 Dec 2013 00:22:52 -0500 Message-ID: Subject: Re: directory alias To: TJ Luoma Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 Ah, of course. Thanks for the idea... I feel stupid. On Tue, Dec 3, 2013 at 11:41 PM, TJ Luoma wrote: > > function cd { > > if [ "$#" = "0" ] > then > # if no arg, go to $HOME > chdir "$HOME" > else > if [ -d "$@" ] > then > # if the arg is a valid directory, go there > chdir "$@" elsif [ -n "${$@}" ] && [ -d "${$@}" ] then chdir "${$@}" else > echo "chdir: no such file or directory: $@" > return 1 > ;; > esac > fi > } If I could only inject variables into the function like: local $cd::foo="/usr/local/foo" so I could do that from the command line and wouldn't have any namespace conflicts, that'd be perfect. But, I can live with global I guess.... > > > > > On Tue, Dec 3, 2013 at 10:21 PM, shawn wilson wrote: >> >> not sure if this is really a 'zsh thing' but I'm looking for a way to >> create aliases for a command. I don't want a bunch of symlinks in my >> home directory, and I don't want a universal alias for each directory >> I commonly cd into. What I want is a way to do: >> cd foo >> and it go to ~/some/deep/directory/tree/foo >> and >> cd bar >> and it go to /usr/local/some/path/bar >> >> Is there some zsh-ism (or better bash-ism that also works in zsh so >> that this works on systems I maintain without zsh) to do this without >> symlinks? > >