shar is not installed by default and it is part of
shar-utils. To install:
sudo apt-get install sharutils
The man page for shar has a good amount of information, warnings and examples. From the link:
Shar creates "shell archives" (or shar files) which are in text format and can be mailed. These files may be unpacked later by executing them with /bin/sh. The resulting archive is sent to standard out unless the -o option is given. A wide range of features provide extensive flexibility in manufacturing shars and in specifying shar "smartness". Archives may be "vanilla" or comprehensive.
and it has some examples:
shar *.c > cprog.shar # all C prog sources
shar -Q *.[ch] > cprog.shar # non-verbose, .c and .h files
shar -B -l28 -oarc.sh *.arc # all binary .arc files, into
# files arc.sh.01 thru arc.sh.NN
shar -f /lcl/src/u*.c > u.sh # use only the filenames
Have a look though all the options at the man page for compression, integrity checks, internationalization and more.
It has a counterpart called unshar
Unshar scans mail messages looking for the start of a shell archive. It then passes the archive through a copy of the shell to unpack it. It will accept multiple files. If no files are given, standard input is used.
To extract the files in a shar archive:
$ sh example.shar
unshar is another way to extract files. This also handles
.shar files that begin with email headers or other extraneous data.
$ unshar example.shar