$ script.sh -i /storage/testFile
-i stores the path of /storage/testFile/.
I want to iterate over file in testFile. Everything goes good, but I want to make this code cleaner and add a directory for output and other checks.
A snippet of my code is:
for f in $inDir/*.vcf; do
if [ -f $f ]; #check if file is true or exists
then
if [ ${f: -4} == ".vcf" ] # check if the file ends with .vcf
then
convert2annovar.pl -format vcf4 "$f" > ./"$f".avinput #run my code
fi
fi
done
Issue:
echo $f returns /storage/testFiles/test.vcf. How do I get only test.vcf while I iterate in for loop?