--- contrib/cdargs-bash.sh.orig 2010-01-11 21:28:40.000000000 +0100
+++ contrib/cdargs-bash.sh 2010-01-11 21:31:05.000000000 +0100
CDARGS_SORT=0 # set to 1 if you want mark to sort the list
CDARGS_NODUPS=1 # set to 1 if you want mark to delete dups
+# Support ZSH via its BASH completion emulation
+if [ -n "$ZSH_VERSION" ]; then
# --------------------------------------------- #
# Run the cdargs program to get the target #
# directory to be used in the various context #
# --------------------------------------------- #
_cdargs_get_dir "$1" && cd "$dir" && echo `pwd`;
# --------------------------------------------- #
# first clear any bookmarks with this same alias, if file exists
- if [[ "$CDARGS_NODUPS" && -e "$HOME/.cdargs" ]]; then
+ 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";
# add the alias to the list of bookmarks
- cdargs --add=":$1:`pwd`";
+ cdargs --add=":$1:`pwd`";
# sort the resulting list
if [ "$CDARGS_SORT" ]; then
sort -o "$HOME/.cdargs" "$HOME/.cdargs";
-# Oh, no! Not overwrite 'm' for stefan! This was
-# the very first alias I ever wrote in my un*x
+# Oh, no! Not overwrite 'm' for stefan! This was
+# the very first alias I ever wrote in my un*x
# carreer and will always be aliased to less...
# add the alias to the list of bookmarks