How can I run commands in bash script?

user3709869

How can I run commands in bash script?

This is my try:

#!/bin/bash

project_path = "/home/user/job/project";
venv = "home/user/job/virtualenv_project";

cd $venv;
source bin/activate;

cd $project_path;
python manage.py runserver;

echo "OK!"

but not working(project_path: not found, venv: not found etc.)

konsolebox

Do not allow spaces between assignments:

#!/bin/bash

project_path="/home/user/job/project";
venv="/home/user/job/virtualenv_project";

cd "$venv";
source bin/activate;

cd "$project_path";
python manage.py runserver;

echo "OK!"

Also it's good to always place arguments with variables inside double-quotes pairs to prevent unexpected word splitting and pathname expansion.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I run commands in a bash script prefixed with sudo, but based on a flag?

How can I print only certain commands from a bash script as they are run?

How can i run multiple commands in python script

How can I run commands in nested SSH connections in Bash?

How to run these two heroku commands in a bash script?

In zsh how can I run a script which is written for bash

How can I run executable in a different folder with a bash script?

How can I run a bash script without affecting the file system?

How can I use $(pwd) in a bash script run via crontab?

How Can I Run a Bash Script in Meteor JS?

How can I run a node script from bash using cron

How do I translate a set of powershell commands into a script that I can run when I want?

In BASH How Do I save up commands to be run after the rest of the script has completed?

How do I run a shell script without using "sh" or "bash" commands?

Run commands in parallel in bash script

Run complex commands on bash script

Bash script to run commands if in directory

How can I run commands in batches?

When I run a Bash script, how can I assure that the same script is not already running?

How can I run commands of a python script from OS process sampler jmeter?

How can I run Wraith and Bash commands from my electron app?

How can a Bash script tell how it was run?

How can I serialize bash commands?

How to run PowerShell core commands in bash script directly?

how to run multiple commands on a remote linux server using bash script

How to run multiple commands in bash script if my condition is true

How can i replace the column header and values in a csv file using bash script commands?

How can I use the pipeline output from different commands inside a custom bash script?

How can I run an expect script to SSH in a server and set a value inside a bash script