I was tasked with running a script developed by someone else. It's quite simple, but it's a bash script and I had almost never touched Linux, so I'm not sure on how to proceed. I was able to install WLS so I can run bash on Windows, but now I have to run a specific python script inside the bash script. The script goes like this:
#!/bin/bash
BASE_DIR=dir
find $BASE_DIR -type f | grep '\.pdf' | while read pdf_filename; do
filebase=`echo $pdf_filename | cut -d '.' -f 1`
txt_filename="$filebase.txt"
echo "Processing $pdf_filename..."
pdf2txt.py $pdf_filename > $txt_filename
echo "Done!"
done
It should run the pdf2txt.py script, but I'm getting this error:
convert_all.sh: line 8: pdf2txt.py: command not found
So, I'm not sure how to connect bash to my Python installation, I'm guessing it's not being able to find it. I would ideally like to link it to this project's virtual environment . Any ideas on how to proceed?
Edit:
This is my current error based on what I responded to @DV82XL:
/mnt/c/Users/jeco_/Desktop/Otros repositorios/sesgo_medios/Code/hello.py: line 1: $'\r': command not found
/mnt/c/Users/jeco_/Desktop/Otros repositorios/sesgo_medios/Code/hello.py: line 2: syntax error near unexpected token `"hello world"'
/mnt/c/Users/jeco_/Desktop/Otros repositorios/sesgo_medios/Code/hello.py: line 2: `print("hello world")'
pdf2text.pydirectly, you may need to usepython pdf2text.py .... Python scripts are not initially set up to be directly executable. Also, you’ll need to make sure yourPATHincludes the location ofpdf2text.py.convert_all.sh: line 8: python: command not foundpythonexecutable is not in your PATH, or thatpdf2txt.pyhas an incorrect `#!' -line. Did you check this?