user6124024
user6124024

Reputation:

Extract tar file after copy without success

Im copy tar file form folder A to folder B and I want that when it finish to copy it to unzip it, I try with the following in my shell script which doesnt work,any idea?

cp /home/i557956/A/file.tar  /home/i557956/B
tar -xvf /home/i557956/B/file.tar

The copy was success but the tar is not extracted in B folder...

Upvotes: 2

Views: 310

Answers (1)

blue112
blue112

Reputation: 56432

Try to move into the B folder before extracting:

cp /home/i557956/A/file.tar  /home/i557956/B
(cd /home/i557956/B/ && tar -xvf file.tar)

Upvotes: 1

Related Questions