You are not logged in.

#1 2008-11-05 12:03:30

eyolf
Member
From: Copenhagen
Registered: 2005-11-29
Posts: 339
Website

zsh and cdargs: parse error

The following is a shell function which comes with the excellent little tool cdargs. I use it with zsh, but it stopped working after the latest upgrade, I think it was. It's the first "if" line that gives a parse error. Does anyone more skilled in zsh know how to fix it? (My hackish solution has been to comment out that if block...).

# --------------------------------------------- #
# Mark the current directory with alias         #
# provided and store as a cdargs bookmark       #
# directory                                     #
#                                               #
# @param  string alias                          #
#                                               #
# @access public                                #
# @return void                                  #
# --------------------------------------------- #
function mark () 
{ 
    local tmpfile

    # first clear any bookmarks with this same alias, if file exists
    if [[ "$CDARGS_NODUPS" && -e "$HOME/.cdargs" ]]; then
        tmpfile=`echo ${TEMP:-${TMPDIR:-/tmp}} | sed -e "s/\\/$//"`
        tmpfile=$tmpfile/cdargs.$USER.$$.$RANDOM
        grep -v "^$1 " "$HOME/.cdargs" > $tmpfile && 'mv' -f $tmpfile "$HOME/.cdargs";
    fi
    # add the alias to the list of bookmarks
    cdargs --add=":$1:`pwd`"; 
    # sort the resulting list
    if [ "$CDARGS_SORT" ]; then
        sort -o "$HOME/.cdargs" "$HOME/.cdargs";
    fi
}

Offline

#2 2008-11-06 04:20:50

ssjlegendx
Member
Registered: 2008-01-01
Posts: 94
Website

Re: zsh and cdargs: parse error

eyolf wrote:

Does anyone [...] know how to fix it?

It seems that that particular line (169 in /usr/share/cdargs/cdargs-bash.sh) can be fixed by changing it to either the following (though I am still prevented from sourcing the file due to its use of complete):

if [ "$CDARGS_NODUPS" ] && [[ -e "$HOME/.cdargs" ]]; then
if [ "$CDARGS_NODUPS" ] && [ -e "$HOME/.cdargs" ]; then

#!/vim/rocks

Offline

Board footer

Powered by FluxBB