The first thing: Use (CODE) button (which inserts tags) so we can refer to line numbers and see the code more pretty.
echo "echo $i 1>&2"
echo "cat >$i <<'End of $i'"
echo "End of $i"
Line 1 and 2 (finished in line 7) loop through the command line args
line 3 echo what you are doing (incorrectly done if you want to put onto stderr)
line 4 another possible error, much line line 3
line 5 Do the work
line 6 put an ending line onto stdout
line 7 end of loop
Of course if you just want to put many files together (without the start and end lines), you can do it as one line
cat file1 file2 file3 > outputfile
Edited 3 Years Ago by mike_2000_17: Fixed formatting
I think you are missing the point. The script does not just cat files together. It creates another script, which serves as a primitive self-extracting archive. Let's see what happens when you invoke it as ./bundle.sh file1 file2>new.sh As you said, line 3 just logs a progress message on a stderr, and new.sh gets written with
cat >file1 << End of file1
... body of file1 ...
End of file1
cat >file2 << End of file2
... body of file2 ...
End of file2
The << construct is a so called "here document". When new.sh is running, the data between matching strings (in this case, "End of file1") gets sent to stdin of the command (in this case, cat). That is, new.sh will write the body of file1 into file1, and the body of file2 into file2.
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...