Find files that they have the same filename but different extension.
I am writing a script which it searches into a directory for two specific file extensions. An .ear and a .war file. When it finds those files who have those extensions then it should search in the same directory to find if there are any files who they have the same name as the first ones but different extension. This extension is .config. My problem is that I am trying to do it and I think I am doing it wrong. Can someone help me to sort out this problem?
This is the code I have written so far:
for file in $(find /home/user/ftpuser -maxdepth 1 -name "*.[ew]ar" -type f);
do
file=${file%*.[ew]ar}
locate /home/user/ftpuser ${file}.config
|