This is NOT a homework question, this is a question from an old exam, so anyone giving an answer will not be contributing to academic dishonesty. For those still skeptical, I am simply seeking what command I could use for this.
You have a file called one_mb which is exactly 1 megabyte in size. You want to create from it a file of exactly 128 megabytes in size. Please write a shell script to do this with at most 9 lines and no loops, if statements, recursion, or any other logic control structures. Each command, including parameters, must be less than 100 characters in length.
I began to research xarg, but could not figure out a good way to use it to accomplish this.
Not sure if this counts, but this came to mind:
seq 1 128 | xargs -Inone cat one_mb >> 128_mb
No loops were used, just a pipe and xargs
.
Assuming bash, you can use a one-line brace expansion hack:
cat one_mb{,}{,}{,}{,}{,}{,}{,} > 128_mb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With