[SOLVED] Need to translate windows command to bash script

Issue

I need to translate the following windows command to bash:

echo %BUCKET%
cd %script_folder%
if not exist "venv" (virtualenv -p C:\Python37\python.exe venv)
cd venv\Scripts\
call activate
cd ..\..\
pip install -r requirements.txt
pause

What I came with was:

echo %BUCKET%
cd %script_folder%
   #if not exist "venv" (virtualenv -p C:\Python37\python.exe venv) -- How?
cd venv/Scripts/
   #call activate -- How?
cd ../../
pip install -r requirements.txt | less

I am not sure the conversion is correct and in any case I do not know how to convert the "How?" labeled rows.

Solution

echo $BUCKET
cd $script_folder

if [ ! -d venv ]; then
    python3 -m venv venv
fi

source venv/bin/activate
python3 -m pip install -r requirements.txt | less

Answered By – serghei

Answer Checked By – Marilyn (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.