skip to Main Content

I have created a virtual environment on my debian system and i made a script that activates it (should).

However when i execute the script nothing shows up, not even an error, my guess is that it is running in a different shell or something but I don’t know how to solve it.

Here is the code of the script

#!/bin/bash
source ~/PythonEnv/environments/my_env/bin/activate

I have changed the permissions already with chmod u+x, so that is not a problem.

When i execute the script nothing shows up at all. Any thoughts???

2

Answers


  1. Add set -x at the beginning of your bash script will do the trick.

    -x  Print commands and their arguments as they are executed.
    

    You can see more bash options here
    http://linuxcommand.org/lc3_man_pages/seth.html

    Login or Signup to reply.
  2. Adding x-permissions is not necessary, since you are using source with an absolute path. Of course this sets the environment only which is executed by the shell script which you have posted here. If you want the changes in your interactive shell, it is pointless to do it inside a script. You have to source the activate script in your shell (respectively inside that process where you want the environment to be modified).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search