shell - Run an Executable Terminal Program in Linux for Multiple Files to Produce Multiple Output Files -
shell - Run an Executable Terminal Program in Linux for Multiple Files to Produce Multiple Output Files -
i have executable programme run in linux terminal. programme works follows:
in terminal come in name of program. gives me next prompts: outputfile, times, input file, option, ect. i'm trying create script run programme on files in directory. of prompts programme gives same, except output , input files differ file file. there approximately 300 input files named 001h.pdb ... 300h.pdb. need output files 001p.acc ... 300p.acc.
(also, responses program's prompts are: "outputfile", 1, "inputfile", bnl, next, next, allatm, next, next, no.)
what reasonable csh script?
i think might trick...
#!/bin/bash # loop through .pdb files f in *.pdb echo debug: processing $f out=${f/h.pdb/p.acc} # determine name of output file # echo parameters needed programme "prog" ( echo "$out" echo 1 echo "$f" echo bnl echo next echo next echo allatm echo next echo next echo no ) | ./prog done
save above in file called auto
, type next firstly alter mode (and thereby create executable) , run it:
chmod +x auto ./auto
depending whether value conciseness on readability, may or may not prefer next identical in function:
#!/bin/bash # loop through .pdb files f in *.pdb out=${f/h.pdb/p.acc} # determine name of output file echo debug: processing $f $out # echo parameters needed programme "prog". note "\n" newline echo -e "$out\n1\n$f\nbnl\nnext\nnext\nallatm\nnext\nnext\nno" | ./prog done
linux shell terminal executable csh
Comments
Post a Comment