null_reflections
Legendary Coder
I found this series of commands online for copying a file multiple times...the way this is, all you have to do is put a real file's name in place of <input-file>, and then choose a name for the duplicates (it can be the same since the loop will suffix numbers to the name anyway...):
Then, you will have 5 copies of the exact same file.
I'm wondering if there's a way to automate this as a script that takes the file as an argument? So lets say my script was named d5:
I know that scripts in bash will easily take arguments listed after them, but i'm having a lot of trouble figuring out how to make this work.
Code:
for i in {1..5}; do cp <input-file> "duplicate_name$i" ; done
Then, you will have 5 copies of the exact same file.
I'm wondering if there's a way to automate this as a script that takes the file as an argument? So lets say my script was named d5:
Code:
d5 <file-in-working-directory>
I know that scripts in bash will easily take arguments listed after them, but i'm having a lot of trouble figuring out how to make this work.