Re: [問題] 為什麼TAR不能兼容舊的...

看板Linux作者時間17年前 (2009/02/16 17:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串6/6 (看更多)
※ 引述《DomainT.bbs@ptt.cc (DomainT)》之銘言: > 我安裝的是環境及要裝的軟體全部都是英文的,所以不會有中英文的問題。 > 目前網路上在裝那套軟體的人,也有很多遇到同樣問題。 > 而解決方式,就是把red hat 9.0的/bin/tar 和 /bin/sort > copy到自己linux下的/bin,也就是把tar及sort換成舊版的。 你第一篇描述的似乎不清楚,這篇才明確把問題說出來。 你想知道原因嗎?很簡單啦,因為當做製作包那個 script 的人, 用到了舊式語法引起的問題。 我舉例像是 head -5 filename 是取該檔案前 5 行,這種用法 是舊有以前的用法,正確一點的方式應該是 head -n 5 filename 才對。其他像是 tail +3 也是以前的使用語法。 解決方式?很簡單根本不需要去裝舊版本程式。 export _POSIX2_VERSION=199209 這樣就可以解決了。想知道原因? File: coreutils.info, Node: Standards conformance 2.9 Standards conformance ========================= In a few cases, the GNU utilities' default behavior is incompatible with the POSIX standard. To suppress these incompatibilities, define the `POSIXLY_CORRECT' environment variable. Unless you are checking for POSIX conformance, you probably do not need to define `POSIXLY_CORRECT'. Newer versions of POSIX are occasionally incompatible with older versions. For example, older versions of POSIX required the command `sort +1' to sort based on the second and succeeding fields in each input line, but starting with POSIX 1003.1-2001 the same command is required to sort the file named `+1', and you must instead use the command `sort -k 2' to get the field-based sort. The GNU utilities normally conform to the version of POSIX that is standard for your system. To cause them to conform to a different version of POSIX, define the `_POSIX2_VERSION' environment variable to a value of the form YYYYMM specifying the year and month the standard was adopted. Two values are currently supported for `_POSIX2_VERSION': `199209' stands for POSIX 1003.2-1992, and `200112' stands for POSIX 1003.1-2001. For example, if you have a newer system but are running software that assumes an older version of POSIX and uses `sort +1' or `tail +10', you can work around any compatibility problems by setting `_POSIX2_VERSION=199209' in your environment. -- 如果真的愛一個作業系統 怎能不害怕不再能使用它 而我們必須接受現實 於是長大了 寂寞就是沒有了機會再用它 比沒有電腦還要寂寞 而那些點亮我們生命的作業系統 就彷彿電影中發生在暹邏的愛情故事 即使短暫使用也會刻骨銘心 To all the Linux that bring us to kernel. -- ※ Origin: SayYA 資訊站 <bbs.sayya.org> ◆ From: kendlee.sayya.org
文章代碼(AID): #19cJAI00 (Linux)
討論串 (同標題文章)
文章代碼(AID): #19cJAI00 (Linux)