3

I have a very simple run.sh script which looks like this:

#!/bin/sh
echo "Hello, let's start!"
cd /Users/c/Dev/App/Code/
. venv/bin/activate
cd Backend
export FLASK_APP=app.py
export FLASK_DEBUG=1
export CONFIG=Local
flask run

After I run it, I get the following:

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

Instead, I would like to get the active session as I would if I type the script manually, so simply the virtualenv active where I can then run pip install and see Flask's output.

How can I do that?

Costantin
  • 133

1 Answers1

3

If you want a active session after the script, don't run it, source it:

$ source ./run.sh
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

$

You can also start a new bash/sh session in your script and add the environment variables there. But that complicates things...

Simon Sudler
  • 4,111