I'm working in the same directory of the files. I have files with three different extensions. I want to perform each one of the five commands on a file with the specific extension by passing them as arguments to the for loop.
I want when I run the code like:
$my_code.sh *.zap *.F *.T
I want the script to perform each command in the specific extension and prepare a list of command at the end and append them as output.
When I run the code as is, it will just take the first arguments (which contains files with *.zap files) and will perform all the commands on it, but what I want is apply each command in specific files with extension.
here is my code:
#!/bin/bash frequ=$1 tim=$2 zap=$3 ls -1 * | for i in "$@"; do echo pav -g \""$frequ"_"avprof.ps/cps"\" -DT $frequ echo pav -g \""$tim"_"fprof.ps/cps"\" -Gd $tim echo pav -g \""$tim"_"ds.ps/cps"\" -j $tim echo pav -g \""$frequ"_"stack.ps/cps"\" -R $frequ echo psrplot -D \""$zap"_"bp.ps/cps"\" -p freq+ $zap done >> ps_files.txt