SHAR(1)

NAME
shar - create a shell archive of files

SYNOPSIS
shar [-br] [-o archive-file] file ...

DESCRIPTION
The shar command writes a sh(1) shell script which will recreate the file hierarchy specified by the command line operands.

The shar command is normally used for distributing files by ftp(1) or mail(1).

The following options are available:

-b  Use an alternative binary format. Content of files will be uuencoded. This option should be used to archive binary files correctly. In this mode also file permissions will be stored to the archive. uudecode(1) is needed to extract archives created with this option.

-o archive-file
    Redirect output to archive-file.

-r  If file given on command line is a directory the entire subtree will be archived. Symbolic links given on command line are followed. Other symbolic links will be archived as such.

EXAMPLES
To create a shell archive of the program ls(1) and mail it to Rick:

    cd ls
    shar -r . | mail -s "ls source" rick

To recreate the program directory:

    mkdir ls
    cd ls
    ...
    <delete header lines and examine mailed archive>
    ...
    sh archive

SEE ALSO
compress(1), mail(1), tar(1), uuencode(1), uuencode(5)

HISTORY
The shar command appeared in 4.4BSD. This is a re-implementation based on the libarchive(3) library.

BUGS
The shar command makes no provisions for hard links.

Files containing magic characters or files without a newline ('\n') as the last character are not handled correctly with the default format. Use the -b option for binary files.

It is easy to insert trojan horses into shar files. It is strongly recommended that all shell archive files be examined before running them through sh(1). Archives produced using this implementation of shar may be easily examined with the command:

    egrep -v '^[X#]' shar.file