1.\" $OpenBSD: shar.1,v 1.12 2011/05/02 11:14:11 jmc Exp $ 2.\" $NetBSD: shar.1,v 1.4 1995/08/18 14:55:40 pk Exp $ 3.\" 4.\" Copyright (c) 1990, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)shar.1 8.1 (Berkeley) 6/6/93 32.\" 33.Dd $Mdocdate: May 2 2011 $ 34.Dt SHAR 1 35.Os 36.Sh NAME 37.Nm shar 38.Nd create a shell archive of files 39.Sh SYNOPSIS 40.Nm shar 41.Ar 42.Sh DESCRIPTION 43.Nm shar 44writes an 45.Xr sh 1 46shell script to the standard output which will recreate the file 47hierarchy specified by the command line operands. 48Directories will be recreated and must be specified before the 49files they contain (the 50.Xr find 1 51utility does this correctly). 52.Pp 53.Nm shar 54is normally used for distributing files by 55.Xr ftp 1 56or 57.Xr mail 1 . 58.Sh EXAMPLES 59To create a shell archive of the program 60.Xr ls 1 61and mail it to Rick: 62.Bd -literal -offset indent 63$ cd ls 64$ shar `find . -print` | mail -s "ls source" rick 65.Ed 66.Pp 67To recreate the program directory: 68.Bd -literal -offset indent 69$ mkdir ls 70$ cd ls 71\&... 72<delete header lines and examine mailed archive> 73\&... 74$ sh archive 75.Ed 76.Sh SEE ALSO 77.Xr compress 1 , 78.Xr mail 1 , 79.Xr tar 1 , 80.Xr uuencode 1 81.Sh HISTORY 82The 83.Nm 84command appeared in 85.Bx 4.4 . 86.Sh BUGS 87.Nm shar 88makes no provisions for special types of files or files containing 89magic characters. 90.Pp 91It is easy to insert trojan horses into 92.Nm shar 93files. 94It is strongly recommended that all shell archive files be examined 95before running them through 96.Xr sh 1 . 97Archives produced using this implementation of 98.Nm shar 99may be easily examined with the command: 100.Bd -literal -offset indent 101$ egrep -v '^[X#]' shar.file 102.Ed 103