Article 5E414 rename file according to one parameter not working

rename file according to one parameter not working

by
Pyrrhus6
from LinuxQuestions.org on (#5E414)
Hello,
I am a beginner in Unix and I use Ubuntu.
I try to write a script in bash that would add the suffix -old to the files whose type is the parameter entered by the user. For instance, I would like all *.txt to be renamed *.txt-old. I tried multiple scripts, the last one being in the file attached (I am sorry, but [IMG] code seems to be off, I don't know why, I tried to change my options)

When I activate the script with ./multiplerename.sh *.txt, it modifies only one file in my directory, file.txt , and this file becomes *-old !
I read many things on the internet, but couldn't find an answer to my specific issue. I hope you can help me, because I have been working on it for many hours and I begin to despair.
Thank you for your help !

Pyrrhus6
Attached Thumbnailsattachment.php?attachmentid=35605&stc=1& latest?d=yIl2AUoC8zA latest?i=srWekieTUAk:6LfmMU8Ntvk:F7zBnMy latest?i=srWekieTUAk:6LfmMU8Ntvk:V_sGLiP latest?d=qj6IDK7rITs latest?i=srWekieTUAk:6LfmMU8Ntvk:gIN9vFwsrWekieTUAk
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments