From: Junio C Hamano Date: Tue, 01 Jan 2013 22:12:40 GMT Subject: Re: [PATCH 2/4] t9810: Do not use sed -i Message-ID: <7v38yk8sdj.fsf@alter.siamese.dyndns.org> In-Reply-To: <201301012240.37769.tboegi@web.de> Torsten Bögershausen writes: > sed -i is not portable on all systems. > Use sed with different input and output files. > Utilize a tmp file whenever needed > > Signed-off-by: Torsten Bögershausen > --- > t/t9810-git-p4-rcs.sh | 24 ++++++++++++++---------- > 1 file changed, 14 insertions(+), 10 deletions(-) > > diff --git a/t/t9810-git-p4-rcs.sh b/t/t9810-git-p4-rcs.sh > index 0c2fc3e..5bf9291 100755 > --- a/t/t9810-git-p4-rcs.sh > +++ b/t/t9810-git-p4-rcs.sh > @@ -26,10 +26,8 @@ test_expect_success 'init depot' ' > line7 > line8 > EOF > - cp filek fileko && > - sed -i "s/Revision/Revision: do not scrub me/" fileko > - cp fileko file_text && > - sed -i "s/Id/Id: do not scrub me/" file_text > + sed fileko > + sed file_text Making it shorter and more correct ;-), which is good, but you are losing the && chaining. Also it is more customary to have redirection at the end, unless it is to redirect a numbered file descriptor (e.g. "echo >&2 error message"). I.e. sed "s/Revision/Revision: do not scrub me/" fileko && sed "s/Id/Id: do not scrub me/" file_text