Author: fernape (ports committer)
Date: Tue Oct 20 13:05:25 2020
New Revision: 366895
URL: https://svnweb.freebsd.org/changeset/base/366895

Log:
  compress(1): Add EXAMPLES section
  
  Add 5 examples showing basic usage.
  
  Approved by:  manpages (gbe@)
  Differential Revision:                https://reviews.freebsd.org/D26865

Modified:
  head/usr.bin/compress/compress.1

Modified: head/usr.bin/compress/compress.1
==============================================================================
--- head/usr.bin/compress/compress.1    Tue Oct 20 11:49:19 2020        
(r366894)
+++ head/usr.bin/compress/compress.1    Tue Oct 20 13:05:25 2020        
(r366895)
@@ -32,7 +32,7 @@
 .\"     @(#)compress.1 8.2 (Berkeley) 4/18/94
 .\" $FreeBSD$
 .\"
-.Dd May 17, 2002
+.Dd October 20, 2020
 .Dt COMPRESS 1
 .Os
 .Sh NAME
@@ -186,6 +186,40 @@ utility exits 2 if attempting to compress a file would
 and the
 .Fl f
 option was not specified and if no other error occurs.
+.Sh EXAMPLES
+Create a file
+.Pa test_file
+with a single line of text:
+.Bd -literal -offset indent
+echo "This is a test" > test_file
+.Ed
+.Pp
+Try to reduce the size of the file using a 10-bit code and show the exit 
status:
+.Bd -literal -offset indent
+$ compress -b 10 test_file
+$ echo $?
+2
+.Ed
+.Pp
+Try to compress the file and show compression percentage:
+.Bd -literal -offset indent
+$ compress -v test_file
+test_file: file would grow; left unmodified
+.Ed
+.Pp
+Same as above but forcing compression:
+.Bd -literal -offset indent
+$ compress -f -v test_file
+test_file.Z: 79% expansion
+.Ed
+.Pp
+Compress and uncompress the string
+.Ql hello
+on the fly:
+.Bd -literal -offset indent
+$ echo "hello" | compress | uncompress
+hello
+.Ed
 .Sh SEE ALSO
 .Xr gunzip 1 ,
 .Xr gzexe 1 ,
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to