[issue1934] Zsh: dirstack=() does not work as advertised

Thilo Six bts at bts.grml.org
Sat Oct 10 12:59:01 CEST 2015


New submission from Thilo Six <tech at xk2c.de>:

Hello Frank,
Hello Mika,

grmls zshrc contain this lines:
---<---<---<---<---<---<---<---<---<---<---<---<---<---<---<
    # Enabling NULL_GLOB via (N) weeds out any non-existing
    # directories from the saved dir-stack file.
    dirstack=( ${(f)"$(< $DIRSTACKFILE)"}(N) )
---<---<---<---<---<---<---<---<---<---<---<---<---<---<---<

I testet in a clean environment with only grml zshrc and actually
this does not work for me. If $DIRSTACKFILE contain lines with
non-existing dirs these are not weed out but are happily applied
to dirstack=().

This snippet does what i expect:
---<---<---<---<---<---<---<---<---<---<---<---<---<---<---<
    # DOES not work :/
    # # Enabling NULL_GLOB via (N) weeds out any non-existing
    # # directories from the saved dir-stack file.
    # dirstack=( ${(f)"$(< ${DIRSTACKFILE})"}(N) )

    dirstack=()
    dirstacktmp=( ${(f)"$(< ${DIRSTACKFILE})"}(N) )
    for d in "${dirstacktmp[@]}"; do
        [[ -d ${d} ]] && dirstack+=( ${d} )
    done
    builtin typeset -U dirstack
    builtin unset dirstacktmp
---<---<---<---<---<---<---<---<---<---<---<---<---<---<---<


Additionally:
I have created a little function _dirstack_helper() attached
and a "gui" for it xs(), which is the left hand of cd.

But since i am not sure whether those two are wanted in grml i
attached them as is, prior to spending time on hammering them
into a patch.
If you say you would include them i would do that.

----------
files: 0001-make-dirstack-work-as-advertised.patch
messages: 5578
nosy: Xk2c
priority: bug
status: unread
title: Zsh: dirstack=() does not work as advertised
topic: has patch, zsh

_____________________________________
GRML issue tracker <bts at bts.grml.org>
<http://bts.grml.org/grml/issue1934>
_____________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-make-dirstack-work-as-advertised.patch
Type: text/x-diff
Size: 1073 bytes
Desc: not available
URL: <http://ml.grml.org/pipermail/bugs-changes/attachments/20151010/022a5772/attachment.patch>


More information about the Bugs-changes mailing list