LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-27-2009, 07:36 AM   #1
kazemipouya
LQ Newbie
 
Registered: Feb 2009
Posts: 8

Rep: Reputation: 0
tar exclusion in shellscript


when i tar a path in command line, i can exclude some sub directory but, i cant do this when i copy the command in shell script file and run the script!!

Last edited by kazemipouya; 08-27-2009 at 07:37 AM.
 
Old 08-27-2009, 07:37 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Taking a look to the exact command would be useful. Also post any error message you get from the script, thank you.
 
Old 08-27-2009, 08:01 AM   #3
kazemipouya
LQ Newbie
 
Registered: Feb 2009
Posts: 8

Original Poster
Rep: Reputation: 0
in command terminal i write : tar -czvf /path/file.tgz /path/directory --exclude='file'
and shell script : /bin/tar czf /path/file.tgz /path/directory --exclude='file' & > /dev/null
i got the script from one my friend !!
 
Old 08-27-2009, 08:08 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
The & > syntax is not correct. To run a process in background the & must be at the end of the command. Redirection to /dev/null after & means nothing. Furthermore, when testing a script, especially if given from someone else, better to leave all the standard output and standard error onto the terminal (or at least redirect them to a file). Try the following and report any error message:
Code:
/bin/tar -czf /path/file.tgz /path/directory --exclude=file
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 03:48 AM
RSYNC Exclusion? carlosinfl General 4 10-04-2007 07:13 PM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 03:53 AM
pthreads and I/O mutual exclusion oulevon Programming 6 04-29-2006 10:33 PM


All times are GMT -5. The time now is 10:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration