Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: cd -q (was Re: _canonical_path ...)



On 27/03/2008, Peter Stephenson <pws@xxxxxxx> wrote:
>  The more I think about this (and I'd really like to stop now), the more
>  wrong it seems to me that it's so hard to get the shell to cd without
>  side effects.  Indeed, the patch above is incomplete since it omits
>  the new chpwd_functions array, and I haven't work out a foolproof
>  way of suppressing the effect of chpwd without forking the shell.
>  chpwd will typically print a bogus directory to the terminal title
>  bar, which is to be avoided; but it can in principle do anything
>  and if we're not sticking around in the directory the interactive
>  environment really doesn't need to care about the cd.
>
>  Any comments about the following proposal, which adds the -q option
>  to all relevant functions?  If it looks OK, I'll change the function
>  above to unsetopt PUSHD_NO_DUPS and use pushd -q/popd -q to sanitize
>  the directory with REPLY=$PWD and remove the fork.

Nice, I've wanted this on several occasions. Especially since
sometimes my chpwd function breaks constructs like (cd /foo; tar c .)
| tar x. I worked around that by printing everything to stderr instead
but it seems icky.

Also, I realized I didn't know what the existing options -sLP did, so
I looked at the manpage and
1) there's a typo near the beginning
Otherwise, if var(arg) begins with a slash, attempt to change to the
director<missing a y here> given by var(arg).
2)
    If the -P option is given or the CHASE_LINKS option is set,
symbolic links are resolved to their true  values.   If the -L option
is given symbolic links are followed regardless of the state of the
CHASE_LINKS option.
Intuitively this paragraph doesn't make any sense. Both options seem
to do the same thing? (-P || CHASE_LINKS) || -L == -P || -L ||
CHASE_LINKS

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author