You are not logged in.
Pages: 1
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
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
Pages: 1