help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Firing a shell function when I change directories


From: Greg Wooledge
Subject: Re: [Help-bash] Firing a shell function when I change directories
Date: Fri, 7 Dec 2018 10:42:58 -0500
User-agent: NeoMutt/20170113 (1.7.2)

On Fri, Dec 07, 2018 at 07:19:47AM -0800, Maxim Kupfer wrote:
> I'm trying to automate the activation of my python virtual environment so
> that whenever I cd into a directory with a virtual environment, it
> automatically activates. I can already create a function that checks if the
> directory venv is available (and activate if it is), but I can't figure out
> how to make this run after I enter a new directory. Hoping I could get some
> help from this mailing list.

cd() {
  builtin cd "$@" || return
  if [[ -d venv ]]; then
    source whatever
  fi
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]