>modified
for i in file1 file2 file3
do
echo $i@`stat --printf='%y\n' $i`>>modified
done
Having created that file, I'm trying to search it like:
for i in file1 file2 file3
do
var=`grep -w "$i" modified | cut -d'@' -f2`
echo $var
done
As mentioned by Charles, there's no reason to create that modified
file for that (unless you are planning to use that file for another purpose).
Also, you can give different arguments to your stat
command, as in:
stat --printf='%y\n' file1 file2 file3
This gives exactly the same output as what you're aiming for.