[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: :chdir .

From: Joe Zbiciak
Subject: Re: :chdir .
Date: Sat, 7 Aug 2004 06:43:46 -0700 (PDT)

(resend, CC'ing list.)
--- Zenaan Harkness <address@hidden> wrote:

> ~/hdc5/zen/backups/laptop/home/zen/work/...
> ~/work -> hdc5/zen/backups/laptop/home/zen/work/
> When I set chdir to work/, and then create a new screen,
> it starts up
> with a directory of
> ~/hdc5/zen/backups/laptop/home/zen/work/

I think that's your shell expanding the symlink, not
screen.  It tries to work out the cwd, either with a
syscall, or the old-fashioned "chase .. and look for
the directory I was just in".

Many shells will update their notion of cwd incrementally
in response to chdir commands.  Hence, your symlink
the optimization you expect if you "cd ~/work" from an
interactive prompt.  But the shell still needs to figure 
out what directory it starts in, and so your symlink 
"gets expanded", but only because the shell never had the
benefit of seeing it.  Screen didn't "expand" the symlink,
it simply followed it.

If you want to compress your shell prompt, you might
consider adding a test to your .shellrc saying "if I'm in
longpath, cd shortpath".  Example for bash:

[ "${T%/hdc5/zen/backups/laptop/home/zen/work}" != "$T" ]
&& cd ~/work

The "cd ~work" should appear on same line as the "[..] &&"
statement. There are probably better ways to write it, but
I stick to what I know.  :-)



We sell Spatulas, and that's all!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]