How to call cdvirtualenv from a bash script?

The virtualenv package is set up from .bashrc by sourcing /usr/share.../ This file defines a number of functions, among those cdvirtualenv:

function cdvirtualenv {
    virtualenvwrapper_verify_workon_home || return 1
    virtualenvwrapper_verify_active_environment || return 1
    virtualenvwrapper_cd "$VIRTUAL_ENV/$1"

How do I call this function from my own script file?

Simply calling it:



gives me:

/srv/bin$ ./
./ line 3: cdvirtualenv: command not found

>Solution :

I hope this will help you, to call cdvirtualenv from a bash script, you can use the source command to execute the script and then call cdvirtualenv with the name of the virtual environment as an argument.

Leave a Reply