Bash script that creates a local environment for CHICKEN scheme (like virtualenv for Python)
I don't understand why the $(pwd)/ prefix is needed in this condition:


elif [ -e "$(pwd)/${1}" ]; then



If ${1} is an absolute path, the condition may not match the directory, even if it exists. Why not write simply [ -e "${1}" ], which should work well with both relative and absolute paths.



OLDPWD is automatically set by Bash when you change directories,
no need to set it manually.
In any case, since the script is intended to be executed instead of sourced,
there's no need to cd back to $OLDPWD.



As for $(dirname $(dirname ${CHICKEN_HOME})), I think that's nicely readable. For the record, you could use ${CHICKEN_HOME%/*} twice to strip suffixes until the grandparent (+ an extra check for the special case of /). Since parameter expansion is a built-in, this would be faster than executing dirname twice. The performance would make a difference if you called dirname a thousand times in a loop, but that's not the case here. And since using dirname is simpler and more readable, I would stick with that.