shell - Problems with basename in a loop -
i new @ shell script programming , i'm trying execute software reads text , perform it's pos tagging. requires input , output, can seen in execute example:
$ cat input.txt | /path/to/tagger/run-tagger.sh > output.txt
what i'm trying execute line not text, set of texts in specific folder, , homecoming output files same name input files. so, tried script:
#!/bin/bash path="/home/rafaeldaddio/documents/" program="/home/rafaeldaddio/documents/lx-tagger/postagger/tagger/run-tagger.sh" arqin in '/home/rafaeldaddio/documents/teste/*' out=$(basename $arqin) output=$path$out cat $arqin | $program > $output done
i tried 1 file , works, when seek more one, error:
basename: operand ‘/home/rafaeldaddio/documents/teste/3’ seek 'basename --help' more information. ./scriptlxtagger.sh: 12: ./scriptlxtagger.sh: cannot create /home/rafaeldaddio/documents/: directory
any insights on i'm doing wrong? thanks.
you don't want quotes around pattern, , quote variables:
for arqin in /home/rafaeldaddio/documents/teste/* out=$(basename "$arqin") output=$path$out "$program" <"$arqin" >"$output" done
shell for-loop
No comments:
Post a Comment