How to make a .shar file?

I want to know how to make these shar files, i mean to import files to this file and extract them. Could somebody explain me?

2

2 Answers

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:

Description

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:

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

Description

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

You need to install sharutils

sudo apt-get install sharutils

Once installed, you can refer to its man file to know how to use it.

man shar

Basic syntax is:

shar <list of files>
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like