In a bash script such append.sh file, write the following code:
#!/bin/bash
A=/root/tmp/test/a.txt
B=/root/tmp/test/b.txt
cat $A >> $BThe
>> redirects the output of the cat command (which output file A) to the file B. But instead of overwriting contents of B, it appends to it. If you use a single >, it will instead overwrite any previous content in B.
No comments:
Post a Comment