2011. 8. 3. 09:34 Unix
절대 경로를 상대 경로로 풀기
이럴 경우 pax 명령어를 이용하면 손 쉽게 해결할 수 있다.
단, 모든 Unix에서 가능한 것은 아니다.
우선 tar 파일을 풀고자 하는 경로에 복사한다.
다음 명령어를 실행한다.
pax -r -s ',^/,,' -f file.tar
그러면 file.tar의 내용이 $CWD(현재 디렉토리)에 풀리게 된다.
>>>>>>>>>>>>>>> 원문 <<<<<<<<<<<<<<<<<<
UNIX GURU UNIVERSE
UNIX HOT TIP
Unix Tip 3462 - August 2, 2011
http://www.ugu.com/sui/ugu/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
EXTRACT RELATIVE FROM ABSOLUTE
Ever had a tar archive which
was tarred up with an absolute
path, but you need to untar
it to a relative location?
There is an easy way to do
this using the "pax" command.
Note: Not available on all
flavors.
Firstly, copy the archive to
the relative location in
which you wish to untar it.
Then, execute the following
command:
pax -r -s ',^/,,' -f file.tar
The contents of file.tar will now
be in the $CWD.
------------------------------
To Subscribe: http://www.ugu.com/sui/ugu/
To Unsubscribe: http://www.ugu.com/sui/ugu/
To Submit A Tip: http://www.ugu.com/sui/ugu/
==============================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU ADVISES THAT
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.
Unix Guru Universe - www.ugu.com - tips@ugu.com - Copyright 1994-2001
==============================