I'm trying to create a bash script that reads in subfolders within a folder and uses the subfolder as an input for a python program, but for some reason, it can't recognize some simple commands.
So just as a reference, the python program I have takes in two inputs: the subfolder it's taking in (folder must only have files in it) and an output file name.
#!/bin/bash
PATH=/foo/bar/*
for folder in $PATH; do
echo "${folder##*/}"
(cat "${folder##*/}" output.txt) | python3 program.py
done
I've ran the program by itself in the command line and it has worked numerous times, but for some reason this doesn't.
This is the resulting output:
$ bash fileread.sh
> File1
> fileread.sh: line 6: cat: command not found
> fileread.sh: line 6: python3: command not found
> File2
> fileread.sh: line 6: cat: command not found
> fileread.sh: line 6: python3: command not found
Clearly, the echo command works, but somehow the other two stopped working