Article 5CCF9 bash: how to use first parameter of the command as a variable for other next parameters?

bash: how to use first parameter of the command as a variable for other next parameters?

by
postcd
from LinuxQuestions.org on (#5CCF9)
Hello,

numerous times it happen that for example i want to duplicate file where the duplicate will only have different suffix, like:

Quote:
cp "long_file - name here! yaie.ext" "../long_file - name here! yaie - backup.ext"
i would like to use first parameter as a variable for second one, like:

cp "long_file - name here! yaie.ext" "$1_backup"

(adding _backup suffix)

And what if i would like to use the incomplete name as the first parameter, like:
cp long_f* $1*_backup

What is the most simple way to do it please?latest?d=yIl2AUoC8zA latest?i=nIka_KKjV_0:6exG46OXP2Y:F7zBnMy latest?i=nIka_KKjV_0:6exG46OXP2Y:V_sGLiP latest?d=qj6IDK7rITs latest?i=nIka_KKjV_0:6exG46OXP2Y:gIN9vFwnIka_KKjV_0
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