Get file name in shell scrip loop: bad substitution

Hi guys. Good day, morning, afternoon or night, depending on where you live.
I have a script shell in which I am looping on files (absolute path) see code section above.
I always have an error: bad substitution.
:wall:
Is it because my variable file is the index of the loop and not a normal string?

for file in $home/$input/*.txt
do
    echo ${file##*/}.log
done

I specify that I need to loop on the absolute path, as I do not want to go inside the files folder, as I am running the script from a bin folder and want to stay in there.

Thanks for your help.

Is that you looking for ?

for file in $home/$input/*.txt do     basename $file | sed 's/txt/log/'  done 

Hi itkamaraj.
Thanks, it's working well.
I have actually customized it into:

for file in $home/$input/*.txt do     basename $file | sed 's/.txt//'  done

Actually, I will reuse this base name for generating other logs file containing different extensions (bad.log, discard.log...)

Issue is solved.
Thanks.

for file in $home/$input/*.txt
do 
  echo ${file%%.*}.log
done

Hi rdcwayx.
Thanks for you answer, my problem was solved.

However, your command does not work as it is still returning the entire path I wanted to get rid:

/........./filename.log

So first solution suggested was better.
Thanks.