From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13422 invoked by alias); 4 Dec 2013 04:42:20 -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: 18192 Received: (qmail 10784 invoked from network); 4 Dec 2013 04:42:05 -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,HTML_MESSAGE,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=RASSJfmU6xnbYzTyYMzx/2hGG78auqwJBcH/QQWOhxM=; b=d6RPkmSJq6gmQDHjdvexcQAv7hy4n1HD0eHPfHleJivVBXKZHMaACQ1qtHBr269WRd XUPUR42M30ez0YwMWenriI40aqxePSh+jxGYvIV3/5FKbV5glcDBHE4Yd884ZfMaI+fC iyEDtv1s8DDGRJUcZ5LCh529Sm9c/TWEK2nW6u1axIIJ9ohgjzBXff/GvymdhB0jzzzG dZJ4UmgUnr2tgLy4B/0kn91qxqyKmHfYl2jv8YP0lP8h6IS1fmKKiZXBsnWFD0OQ0Z3h wK12ocq/jnBsWDeMvs+OXnLBnqp+w+bw4bLCVv98j0AFpe6kyXQeilpUAfpxja/Wwffe EQeA== X-Received: by 10.229.127.193 with SMTP id h1mr1961165qcs.14.1386132121007; Tue, 03 Dec 2013 20:42:01 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: TJ Luoma Date: Tue, 3 Dec 2013 23:41:20 -0500 Message-ID: Subject: Re: directory alias To: shawn wilson Cc: Zsh Users Content-Type: multipart/alternative; boundary=001a1133dbceaf930004ecae080b --001a1133dbceaf930004ecae080b Content-Type: text/plain; charset=UTF-8 I make variables for directories I use a lot db="$HOME/Dropbox" bin="$db/bin" and then I can use that to either move files (mv foo $bin) or 'cd' to them just by typing the variable "$db" and hitting enter. But if that's what you mean by a "universal alias", then you'd have to do something else. You could make your own `cd` function 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 "$@" else case "$@" in bar) chdir /usr/local/some/path/bar ;; foo) chdir ~/some/deep/directory/tree/foo ;; *) echo "chdir: no such file or directory: $@" return 1 ;; esac fi fi } 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? > --001a1133dbceaf930004ecae080b--