I want to do the following on a bash script:
I want the user to enter a file name and the bash script must move the file to another file as follows. If the user enters input.tex
, I want to move this file to another file named inputmerged.tex
.
I have the following bash script named myscript.sh
:
#!/bin/bash
mv $1 $2
The above however needs to be run as ./myscript input.tex inputmerged.tex
The second input is redundant, since the new file, which I move to, is of the same type and always has the word merged
appended at the end of the first filename. How should I do it to get rid of the second input in the bash script?
Thanks