I have a directory with a lot of .cif files. I want to read through the file names and print the ones ending with .cif to a file.
Here is what I tried:
#!/bin/bash
directory=/MOFS
:>| names_mofs
myfilenames="${directory}/*.cif"
for file in $myfilenames
do
echo $file >> names_mofs
done
But this code prints /MOFS/*.cif
into the names_mofs file. I also need to print the whole name, including the .cif extension.
What should I do?