I am trying to automate running a python command with arguments using multiple files (one at a time) and writing the output in output directories with the same name of the input file but without the extension.
So far I have built made the following script:
#!/bin/sh
for filename in *.faa ; do
python predict_genome.py --fasta_path /Users/mvalvano/DeepSecE/myruns/${filename} --model_location /Users/mvalvano/DeepSecE/model/checkpoint.pt --data_dir data --out_dir myruns/test --save_attn --no_cuda
done
exit 0
This script works, and the output files are saved in a test directory that is specified in the --out_dir
argument. My question is how can I replace test
in the --out_dir
argument with a function that would name the directory with the same name as the input file. I have tried a few options but they do not seem to work.
Thanks
Mike