dot/.config/scriptrc/cd.sh

41 lines
637 B
Bash
Raw Normal View History

2023-07-22 14:46:26 +02:00
function cd
{
if [ $# -eq 0 ]; then
pushd ~ > /dev/null
elif [ " $1" = " -" ]; then
pushd "$OLDPWD" > /dev/null
else
2024-02-21 13:06:01 +01:00
pushd "$1" > /dev/null
fi
if [ "$VIRTUAL_ENV" != "" ]; then
local venvpath=$(dirname $VIRTUAL_ENV)
case $PWD/ in
$venvpath/* ) ;;
*) deactivate;;
esac
fi
if [ -f .venv/bin/activate ]; then
source .venv/bin/activate
fi
if [ $# -gt 1 ]; then
if [ -f Makefile ]; then
make ${@:2}
else
fi
2023-07-22 14:46:26 +02:00
fi
}
function cdd
{
if [ $# -eq 0 ]; then
cd -
else
cd +$1
fi
}
cd $PWD