Running Tar from a Shell Script.

Mark Stoecker webmaster at desertwebdesigns.com
Tue Jul 27 14:07:21 MST 2010


"tar: Removing leading `/' from member names" is because you are not 
running the tar command from within the directory you are archiving.  
Use the -C switch to specify the directory you want to run tar from.

tar -czf /backups/my-backup-$(date +%Y%m%d).tgz -C /work/dev/ *

That will switch to the /work/dev directory and run tar from there, 
backing up everything in it.

On 7/27/2010 1:54 PM, keith smith wrote:
>
>
>
> Hi,
>
> If I run "tar -czf /backups/my-backup-$(date +%Y%m%d).tgz /work/dev/" 
> from the command line, less the quotes, it runs just fine with the 
> exception of the one message that says "tar: Removing leading `/' from 
> member names", which I am not sure exactly what that means.
>
> If I create a shell script with two lines, as follows:
>
>   #!/bin/bash
>
> /bin/tar -czf /backups/my-backup-$(date +%Y%m%d).tgz /work/dev/
>
>
> I get the following output:
>
> : command not founde 2:
> /bin/tar: Removing leading `/' from member names
> /bin/tar: /work/dev/\r: Cannot stat: No such file or directory
> /bin/tar: Error exit delayed from previous errors
> : command not founde 4:
>
> I am not sure why these errors.  Any help is much appreciated.
>
>
> ------------------------
> Keith Smith
>
>
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20100727/113bcb11/attachment.html>


More information about the PLUG-discuss mailing list