I am trying to remove all ".s" files in a folder that can be derived by ".c" source files. This is my code
for cfile in *.c; do
for cfile in *.c; do
#replace the last letter with s
cfile=${cfile/%c/s}
for sfile in *.s; do
#compare cfile with sfile; if exists delete sfile
if [ $chile==$sfile$cfile==$sfile ]; then
rm $sfile;
fi
done
done
But this code deletes all the ".s" files. I think it's not comparing the filenames properly. Can someone please help.