Others have pointed out that the method you're using isn't the best way to
prepend files. But that wasn't *quite* your question, was it? 

The first time I tried this, I found that the command-line version produced
the output you described. But the script produced two copies of file1's
contents (and no copies of file2's original contenst) in file2. After the
first try, though, I could not replicate that result; all subsequent tries
caused the script and the command-line versions to behave identically in my
tests here.

Since the only problem I could create was transient, perhaps you need to
tell us what the script version *did* do when you ran it? If you run it
several times, doe sthe bahavior change?

Now ... prepending is harder than appending. The safest way is to do
something like the following (untested):

#!/bin/bash
#
cat file1 file2 >file3
rm file2
mv file3 file2

# EOP

At 04:21 PM 1/16/00 +0800, Niclas Hedhman wrote:
>
>If I have two files, 'abc' and 'def'
>
>and I do a
>
>cat abc def | more >def
>
>the content of 'abc' is prepended to the 'def' file.
>
>If I create a script;
>
>#! /bin/sh
>#
>cat abc def | more >def
>
>
>and run it. The content is NOT prepended.
>
>WHY??
>
>And how to do it instead?
------------------------------------"Never tell me the odds!"---
Ray Olszewski                                        -- Han Solo
Palo Alto, CA                                    [EMAIL PROTECTED]        
----------------------------------------------------------------

Reply via email to