Re: [PATCH 2/4] t9810: Do not use sed -i

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Torsten Bögershausen <tboegi@xxxxxx> 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 <tboegi@xxxxxx>
> ---
>  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 <filek "s/Revision/Revision: do not scrub me/" >fileko
> +		sed <fileko "s/Id/Id: do not scrub me/" >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/" <filek >fileko &&
	sed "s/Id/Id: do not scrub me/" <fileko >file_text
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]