diff options
author | 2011-03-05 18:48:26 +0000 | |
---|---|---|
committer | 2011-03-05 18:48:26 +0000 | |
commit | 027eba6da38108aa71121b159a917f3ee05a2254 (patch) | |
tree | ecfcfec9e2a1f66b144d247081f1f2c3f44eab7c | |
parent | remove a stray character (editing accident) i introduced a year ago; (diff) | |
download | wireguard-openbsd-027eba6da38108aa71121b159a917f3ee05a2254.tar.xz wireguard-openbsd-027eba6da38108aa71121b159a917f3ee05a2254.zip |
Shell output redirection truncating the destination file
is neither a bug nor a property of cat(1), so rename BUGS to CAVEATS.
When showing a bad example, also tell the reader what to do instead.
While here, use .Dl to display complete shell command lines, and -
as suggested by jmc@ - avoid displays in the middle of sentences.
feedback and ok jmc@
-rw-r--r-- | bin/cat/cat.1 | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/bin/cat/cat.1 b/bin/cat/cat.1 index 4f179c0348a..f3db08909de 100644 --- a/bin/cat/cat.1 +++ b/bin/cat/cat.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cat.1,v 1.30 2010/09/03 09:53:20 jmc Exp $ +.\" $OpenBSD: cat.1,v 1.31 2011/03/05 18:48:26 schwarze Exp $ .\" $NetBSD: cat.1,v 1.12 1995/09/27 05:38:55 cgd Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 @@ -33,7 +33,7 @@ .\" .\" @(#)cat.1 8.3 (Berkeley) 5/2/95 .\" -.Dd $Mdocdate: September 3 2010 $ +.Dd $Mdocdate: March 5 2011 $ .Dt CAT 1 .Os .Sh NAME @@ -174,10 +174,18 @@ A .Nm utility appeared in .At v1 . -.Sh BUGS +.Sh CAVEATS Because of the shell language mechanism used to perform output -redirection, the command -.Ic cat file1 file2 > file1 -will cause the original data in +redirection, the following command will cause the original data in .Ar file1 -to be destroyed! +to be destroyed: +.Pp +.Dl $ cat file1 file2 > file1 +.Pp +To append +.Ar file2 +to +.Ar file1 , +instead use: +.Pp +.Dl $ cat file2 >> file1 |