All pastes #263448 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-12-01 15:46 UTC
rendered paste body
cd ()
{
    if [ -d "$@" ]; then
        command cd "$@";
        if [ -e "bin/activate" ]; then
            if [ -n "${ACTIVATED}" ]; then
                if [ "${ACTIVATED}" != "${PWD}" ]; then
                    deactivate;
                    unset ACTIVATED;
                else
                    return;
                fi;
            fi;
            source "bin/activate";
            export ACTIVATED="$PWD";
        fi;
        if [ -n "${ACTIVATED}" ]; then
            if (( ! `expr match "${PWD}" "${ACTIVATED}"` )); then
                deactivate;
                unset ACTIVATED;
            fi;
        fi;
    else
        if [ -e "$@" ]; then
            command cd `dirname "$@"`;
        else
            command cd "$@";
        fi;
    fi
}