I want to make a file which will run 2 command.
One will activate a virtual enviroment and after that, second command will run a server.
My file is called "runserver" and it looks like these:
#!/bin/bash
echo "Activating virtual enviroment"
source odoo-venv/bin/activate
echo "Running Odoo server"
./odoo12/odoo-bin --config=/etc/odoo12.conf
When I run this file with
sh runserver
It show the following error:
Activating virtual enviroment...
runserver: 3: source: not found
Running Odoo server...
...
It seems that my bash file is not recognizing the source command, how can I fix this?
Best Answer
sh
doesn't run your script inbash
but indash
which doesn't supportsource
. Use.
instead:or run the script with bash:
See also a similar question on StackOverflow.