[NCLUG] tar

Bill Thorson bill at tstorms.com
Mon Oct 8 11:28:15 MDT 2012


What Aaron said; and these points:
     1) the -v in your tar arguments turns on the "verbose" listing. 
(See 'man tar' again)
     2) Avoid the use of the asterisk in your echo statements. This is a 
wildcard to list all the files in your current directory. You are seeing 
things you didn't want.
     3) The cd /root at the end doesn't do anything for you.  When the 
script ends you will be back where you started with or without this.

Bill

On 10/08/2012 09:45 AM, Aaron D. Johnson wrote:
> Kerry Miller writes:
>> I created a shell script:
>> !#/bin/sh
>> #
>> #File: BK-Kerrym2Documents.sh
>> #
>> cd /home/kerrym2/Documents
>> #
>> tar --recursion -czvpf /mnt/UserBackup/BK-Kerrym2Documents.tar.gz ./
>> #
>> echo
>> echo BKDocuments *** Done ***
>> #
>> cd /root
>>
>> When I run this shell script I get the activity list in my terminal
>> window but I don't the terminating echos I have tried to display I
>> get a list of files that are in the archive.  I have done a man tar
>> and don't see any distinction between seeing the list of files and
>> not seeing the list of files.  Is there something I might be missing
>> about tar?
> That first line should probably read
>
>      #!/bin/sh
>
> (Transpose the # and the !.)  After tar's list of files, you're
> probably seeing a "BKDocuments" followed by a list of files in /root,
> followed by "Done", followed by a list of files in /root, all on one
> (probably wrapped) line.
>
> I don't think you're missing something about tar, instead you're
> probably missing something about how wildcard expansion works.
>
> Try the following:
>
>      cd /root
>      echo Done
>      echo ***
>      echo '***'
>      echo BKDocuments ***
>      echo BKDocuments *** Done ***
>      echo BKDocuments '***' Done '***'
>
> You should be able to see what you need to change in your script from
> there.
>
> - Aaron
> _______________________________________________
> NCLUG mailing list       NCLUG at lists.nclug.org
>
> To unsubscribe, subscribe, or modify
> your settings, go to:
> http://lists.nclug.org/mailman/listinfo/nclug


-- 
/"Bill the son of Thor and grandfather of Odysseus"/



More information about the NCLUG mailing list