I am new at shell script programming and I'm trying to execute a software that reads a text and perform it's POS tagging. It requires an input and an output, as can be seen in the execute example:
$ cat input.txt | /path/to/tagger/run-Tagger.sh > output.txt
What I'm trying to do is to execute this line not only for a text, but a set of texts in an specific folder, and return the output files with the same name as the input files. So, I tried to do this script:
#!/bin/bash path="/home/rafaeldaddio/Documents/" program="/home/rafaeldaddio/Documents/LX-Tagger/POSTagger/Tagger/run-Tagger.sh" for arqin in '/home/rafaeldaddio/Documents/teste/*' do out=$(basename $arqin) output=$path$out cat $arqin | $program > $output done
I tried it with only one file and it works, but when I try with more than one, I get this error:
basename: extra operand ‘/home/rafaeldaddio/Documents/teste/3’ Try 'basename --help' for more information. ./scriptLXTagger.sh: 12: ./scriptLXTagger.sh: cannot create /home/rafaeldaddio/Documents/: Is a directory
Any insights on what I'm doing wrong? Thanks.