[comp.unix.questions] Help with shar needed!

gordon@osiris.cso.uiuc.edu (John Gordon) (10/09/90)

	Hi.  I'm having some problems trying to run the shar program.  I have
some files in a directory that I want to put in a shell archive, so I cd to the
directory, then type "shar * > shar.file".  This produces a 5-minute wait, and
then a "write failed, disk full" error, as shar keeps writing the same stuff
over and over ad infinitum.  Anyone have any help for me?


---
John Gordon
Internet: gordon@osiris.cso.uiuc.edu        #include <disclaimer.h>
          gordon@cerl.cecer.army.mil       #include <clever_saying.h>
GEnie:    j.gordon14                  

jmaynard@thesis1.hsch.utexas.edu (Jay Maynard) (10/09/90)

In article <1990Oct8.181633.6838@ux1.cso.uiuc.edu> gordon@osiris.cso.uiuc.edu (John Gordon) writes:
>	Hi.  I'm having some problems trying to run the shar program.  I have
>some files in a directory that I want to put in a shell archive, so I cd to the
>directory, then type "shar * > shar.file".  This produces a 5-minute wait, and
>then a "write failed, disk full" error, as shar keeps writing the same stuff
>over and over ad infinitum.  Anyone have any help for me?

I've seen this before. What apparently happens is that the shell creates the
output file before expanding the * into the arguments for shar. Shar goes
along and merrily stuff stuff into shar.file; when it gets to shar.file, it
starts reading from the beginning and writing to the end. You can avoid this
behavior from shar by doing "shar * > somewhere.else/file" - as in put the
file somewhere besides the current directory.

-- 
Jay Maynard, EMT-P, K5ZC, PP-ASEL | Never ascribe to malice that which can
jmaynard@thesis1.hsch.utexas.edu  | adequately be explained by stupidity.
"It's a hardware bug!" "It's a    +---------------------------------------
software bug!" "It's two...two...two bugs in one!" - _Engineer's Rap_

a20@nikhefh.nikhef.nl (Marten Terpstra) (10/09/90)

In article <1990Oct8.181633.6838@ux1.cso.uiuc.edu> gordon@osiris.cso.uiuc.edu (John Gordon) writes:
>
>	Hi.  I'm having some problems trying to run the shar program.  I have
>some files in a directory that I want to put in a shell archive, so I cd to the
>directory, then type "shar * > shar.file".  This produces a 5-minute wait, and
>then a "write failed, disk full" error, as shar keeps writing the same stuff
>over and over ad infinitum.  Anyone have any help for me?
>

The solution is quite simple. When typing shar * > shar.file your shell will
also include the file shar.file to the wildcard. This because the file
shar.file is created before the wildcard is fully expanded. Therefore it will
put this output file again in the output file etc. This causes the disk full
message.
So make sure the output file is not in the wildcard e.g. by putting the output
file in another directory.

Marten
--
"               Quidquid Latine Dictum Sit, Altum Viditur.                    "
              ( Whatever is said in Latin, sounds profound )
-------------------------------------------------------------------------------
Marten Terpstra                                  National Institute for Nuclear
Internet : terpstra@nikhef.nl 	          	        and High Energy Physics
Oldie-net: {...}mcsun!nikhefh!terpstra    			     (NIKHEF-H)
DECnet   : nikvx1::a20                                     PO Box 1882, 1009 DB
Phone-net: +31 20 592 5102			     Amsterdam, The Netherlands
-------------------------------------------------------------------------------