Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: named directory expansion on strings
- X-seq: zsh-users 7168
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: named directory expansion on strings
- Date: Sat, 13 Mar 2004 06:41:00 +0000
- In-reply-to: <v5mfocam7x43.dlg@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <v5mfocam7x43.dlg@xxxxxxxxxxxxxxxx>
On Mar 13, 4:29am, Thorsten Kampe wrote:
}
} Is there a way to perform "named directory" expansion on strings?
Sort of. See "print" in "man zshbuiltins" and look at the -D option.
} Something like "autonamedirs" and the "%~" in the prompt...
}
} % file=/etc/foo
} % ETCDIR=/etc
} % echo `bar#!$whatever($file)`
I take it that the stuff in backticks is something that you just made up
to represent an arbitrary cryptic zsh incantation?
} ~ETCDIR/foo
You'd never get that in this particular example. "ETCDIR" has six letters,
plus the tilde makes seven. "/etc" has four letters. Zsh always chooses
whichever one is shorter.
If you did
% setopt auto_name_dirs
% file=/etc/foo
% E=/etc
% print -D $file
Then you'd get
~E/foo
because ~E has only two letters.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author