How to script automate unTAR of packages

Simon Geard delgarde at ihug.co.nz
Mon Dec 28 19:23:15 PST 2009


On Mon, 2009-12-28 at 13:49 -0500, Mikie wrote:
> Hello list,
> 
> I have made a script file at:
> 
> http://www.mikienet.com/linux/LFS-6.5-untar-list
> 
> ... to unTAR my packages so I don't have to do it manually.
> 
> When I run it I get:
> 
> tar: /mnt/lfs/sources/zlib-1.2.3.tar.bz2\r: Cannot open: No such file or
> directory

That "\r" (carriage return) at the end of the file says your scripts is
probably saved using Windows-style end of line characters, a CR-LF pair.
Under Unix, only the LF is used for end of line, and the CR is treated
as part of the filename.

To correct it (by removing the CRs from the file), run the following
command:

sed -i "s/^M//" LFS-6.5-untar-list

And don't use Windows to edit Unix shell scripts or config files if you
can avoid it. It just ends up causing problems like this. As a hint,
running the 'file' command on any text file will tell you if it's using
CRLF end of line characters.

Simon.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-support/attachments/20091229/12410da5/attachment.sig>


More information about the lfs-support mailing list