Sponsored Content
Top Forums Shell Programming and Scripting working with tar exclude command Post 302630091 by ajayyadavmca on Wednesday 25th of April 2012 11:07:05 AM
Old 04-25-2012
working with tar exclude command

i have issue with tar, let me explain

when i run below command it works perfectly as usual.
Code:
tar -cvf /tmp/temp.tar --exclude="exclusion expression" dir

my requirement is
Code:
--exclude="exclusion expression"

will come from another variable.
so when i execute below command:
Code:
tar -cvf /tmp/temp.tar "$patern" dir

it interprets it as
Code:
tar -cvf /tmp/temp.tar '--exclude="exclusion expression" ' dir

see it adds extra single quotes and command fails.

anybody please help, i hope its very easy.

i tried using sed and removing single quote from variable but that not the problem as soon as i give here as parameter to tar command it gets converted same.

Last edited by ajayyadavmca; 04-25-2012 at 01:13 PM..
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

tar: how to exclude subdirectories?

If i have a bunch of directories that i normally backup with this: tar cvhf /dev/rmt/0 /export/home How can i exclude certain subdirectories under the /export/home? tar cvhf /dev/rmt/0 /export/home | grep -v 'test' ? will that exclude anything named test, and any subdirectories under test? (7 Replies)
Discussion started by: kymberm
7 Replies

2. UNIX for Dummies Questions & Answers

Getting 'tar' to exclude

I want 'tar' to exclude certain dir's. tar cvf ............. ............ does the whole lot, but I want to exclude the 'log' dirs. (6 Replies)
Discussion started by: kuultak
6 Replies

3. UNIX for Dummies Questions & Answers

Tar directory but exclude other

OS: SunOS perfs01 5.8 Generic_117350-23 sun4u sparc SUNW,UltraAX-i2 I want to tar a directory, but there are subdirectoires I want to exclude. Does anyone know how to do it? Please help. thanks. (1 Reply)
Discussion started by: leemjesse
1 Replies

4. Solaris

tar exclude list

I have solaris 8, I want to create tar for all files under this directory structure #/export/home/atg/Dynamo/home There is a subdirectory under this tree called servers/supersds/logs I want to exclude logs subdirectory so I created exclude list which contains servers/supersds/logs But tar... (2 Replies)
Discussion started by: Tirmazi
2 Replies

5. SCO

Tar exclude

Hi, We work on a UNIX SCO SCO_SV Release = 3.2v5.0.5. I have a folowing structure /u/usr/lpp /u/usr/lpp/SQL /u/usr/lpp/DIR2 I use following tar to backup the /u/usr/lpp directory cd /u/usr/lpp tar cvf /u/usr/backup/backup.tar . Now I want to exclude the subdirectory SQL. I... (2 Replies)
Discussion started by: haezeban
2 Replies

6. UNIX for Dummies Questions & Answers

Executing a tar command with the --exclude option in a Debian shell script.

Hi All, I am trying to execute the following tar command with two --exclude options to suppress extract of the two directories specified. Do I need to single quote the directory paths ?? Many thanks for your help. The relevant code excerpt from the script is: cd /var/www/${SITE} ... (7 Replies)
Discussion started by: daveu7
7 Replies

7. AIX

Exclude Directories in my tar command

Hi, im having some issues after i execute the next command: tar -cvf /varios/restore/test.tar -X /jfma/test1/excludefile /jfma | gzip -c > /varios/restore/test.tar.gz this creates the desired "test.tar.gz" file, but whe i try to open it it says "tar: 0511-164 There is a media read or write... (6 Replies)
Discussion started by: blacksteel1988
6 Replies

8. UNIX for Dummies Questions & Answers

Exclude file with tar

hi, i am trying to use a exclude file to exclude some file directories while making a tar archive. This is my command: tar -pcvf orahome10gR2.tar.gz db_1 -X /home/oracle/excludeFile.txt /home/oracle/ when i execute it, it seem to be tar-ing. But once is done, i cd to /home/oracle and could... (2 Replies)
Discussion started by: redologger
2 Replies

9. Solaris

TAR exclude is not working !

I have solaris 10 and my following exclude is not working: tar -cvf /export/home/backups/$audit-Data-$useday.bkup.tar /Data --exclude=/Data/ssg/output a /Data/ssg/output/ 0K a /Data/ssg/output/ssg-ported508.txt 107142K a /Data/ssg/output/ssg-ported747.txt 1801K a... (4 Replies)
Discussion started by: mrn6430
4 Replies

10. Shell Programming and Scripting

Need Tar Ball command to exclude directories

Hi, uname -a SunOS mymac 5.11 11.2 sun4u sparc SUNW,SPARC-Enterprise I need to tar a folder /tmp/moht but do not want these three folders to be included in the tar file -> savejpg, bmpsave and imgsave I tried --exclude, -path, -not options but it says bad option Can you help me with... (3 Replies)
Discussion started by: mohtashims
3 Replies
bup-join(1)						      General Commands Manual						       bup-join(1)

NAME
bup-join - concatenate files from a bup repository SYNOPSIS
bup join [-r host:path] [refs or hashes...] DESCRIPTION
bup join is roughly the opposite operation to bup-split(1). You can use it to retrieve the contents of a file from a local or remote bup repository. The supplied list of refs or hashes can be in any format accepted by git(1), including branch names, commit ids, tree ids, or blob ids. If no refs or hashes are given on the command line, bup join reads them from stdin instead. OPTIONS
-r, --remote=host:path Retrieves objects from the given remote repository instead of the local one. path may be blank, in which case the default remote repository is used. The connection to the remote server is made with SSH. If you'd like to specify which port, user or private key to use for the SSH connection, we recommend you use the ~/.ssh/config file. EXAMPLE
# split and then rejoin a file using its tree id TREE=$(tar -cvf - /etc | bup split -t) bup join $TREE | tar -tf - # make two backups, then get the second-most-recent. # mybackup~1 is git(1) notation for the second most # recent commit on the branch named mybackup. tar -cvf - /etc | bup split -n mybackup tar -cvf - /etc | bup split -n mybackup bup join mybackup~1 | tar -tf - SEE ALSO
bup-split(1), bup-save(1), ssh_config(5) BUP
Part of the bup(1) suite. AUTHORS
Avery Pennarun <apenwarr@gmail.com>. Bup unknown- bup-join(1)
All times are GMT -4. The time now is 08:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy