It is not duplicate, other questions on stackexchange are about getting rid of this message as archive is created.

Is it possible, given archive that was created with -P option (with leading `/')?

I have an archive created with "--absolute-names" (-P option) - with leading /.

I want to unpack it, with / stripped (tar is doing it by default).

It is almost ideal, but I want to silence:

tar: Removing leading `/' from member names.

without removing other messages (so brute force in the form of 2>/dev/null is not a solution).

I found multiple solution how to silence this message during creating archive but none for unpacking. I know about grep -v but it will (a) hide error code from tar (b) add its own error code if message about / is not stripped.

This situation may be replicated with

cd /home/user/tmp
touch a.txt
mateusz@Grisznak:~/Desktop/tmp$ tar --create -P /home/user/tmp > a.tar
mateusz@Grisznak:~/Desktop/tmp$ tar --extract --file=a.tar 

To avoid XY problem: I am unpacking archives created by backup gem (http://backup.github.io/backup/v4/).

share|improve this question
    
Did you try using this 2>/dev/null or &>/dev/null with tar? – George Udosen Mar 22 '17 at 18:35
1  
@George I think the OP wants to make sure other error messages are not discarded, so that may not be the best option. – Arronical Mar 22 '17 at 18:41
    
@George No, as it would silence all error messages. My goal is to get notification from cron about all errors and only errors. – Mateusz Konieczny Mar 22 '17 at 20:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.