notsomeone
June 5th, 2009, 10:50 PM
Is there a way to automatically check if a tar archive has one encapsulating directory, so that it won't spew loose files all over the current directory?
Ideally if there was no directory, one would be created before extracting.
If not, can anybody write a short bash script to check for that? Maybe something that checks if the last character of the first line of `tar tvf` is a "/".
I am fumbling with grep and sed but not getting it right.
Ideally if there was no directory, one would be created before extracting.
If not, can anybody write a short bash script to check for that? Maybe something that checks if the last character of the first line of `tar tvf` is a "/".
I am fumbling with grep and sed but not getting it right.