TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:1885] Redirection of a tar file





Chris Kesler wrote:

> The > redirects standard output (what you would see on the screen) to a
> file.  So, the command below is trying to write a bunch of filenames to a
> file called somedirectory.  Apparently when WindoesN'T tried to copy I/O
> redirection from the Unix shells they didn't end up with an exact copy.
> Un-tarring to a directory is not the expected behavior for stdout
> redirection.
> Try this:
>
> tar -xvf somefile.tar -C /opt/somedirectory
>
> On Thu, 22 Oct 1998, Perry Hoekstra wrote:
>
> > Greet the sun all,
> >
> > How do you redirect the output of a tar extraction.  If it can be done
> > in NT, I know it can be done in Linux. I have looked in the man pages
> > and a couple of books with no luck.  Essentially, I want to:
> >
> > tar -xvf sometarfile.tar > /opt/somedirectory
> >
> > where the > is some type of pipe command to place the files relative,
> > not to the current directory, but the one I specify.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe@listserv.real-time.com
> For additional commands, e-mail: tclug-list-help@listserv.real-time.com
> Try our website: http://tclug.real-time.com

Ed Bertsch wrote:

not quite sure what you want. Why not just do

whereiam=`pwd`
cd $that-directory ; tar -xvf $the-tarfile
cd $whereiam

This is what I ended up doing.  It is one of those things where you just
unable to think outside of the box.  I was so hung up on redirecting the
output of a tar, I couldn't come up with something as simple as Ed's
solution.  I knew there was some switch like -C (see above) within tar in
order to send it to a different directory.

Thank you all

--
Perry Hoekstra - dutchman@mn.uswest.net
-------------------------------------------------
All that is Microsoft does not glitter,
Not all those who wander are lost;
The old AT&T Unix that is strong does not wither,
Deep roots are not reached by frost.

From the ashes of Spec1170 a fire shall be woken,
A light from the shadows shall spring;
Renewed shall be the Unix OS that was broken,
Linux shall be king.