LiFe CycLe

it works, it obsoletes!

2007年6月20日 星期三

在mac中 讓終端機顯示中文

之前已經有一篇介紹如何設定讓終端機顯示中文的
但是這篇是針對之前apple support裡的文章做一點小翻譯
這裡是原文
Mac OS X 10.2: How to Use High-Bit Characters in Terminal

The default configuration of Terminal does not allow you to drag items named with high-bit characters to the command line, or type high-bit characters there. High-bit characters include accented and special characters used in many languages. You may reconfigure Terminal to allow high-bit characters.

原本的終端機設定不允許使用者在終端機中讀取或使用多位元的資料。多位元的字串或資料用在許多的語言上。你可以透過更改終端機的設定,使得終端機可以讀到正確的多位元字串

Symptom
特點

You cannot type high-bit characters at the command line or drag items named with them into the Terminal window.
你不能在命令列輸入多位元字串或是無法讀取多位元字串在終端機中。

Products affected
  • Mac OS X 10.2
  • Terminal

Solution
    1. Open Terminal.
    打開你的終端機
    2. Choose Windows Settings from the Terminal menu. The Terminal Inspector window appears.
    在終端機的選單中選擇視窗設定。出現終端機的監視選單
    3. Choose Emulation from the pop-up menu.
    4. Make sure the checkbox for "Use option key as meta key" is not selected.
    確認"use option key as meta key" 這個選項沒有被選取
    5. Select the checkbox for "Escape 8-bit chars with Ctrl-V".
    選取"Escape 8-bit chars with Ctrl-V"選項
    6. Choose Display from the pop-up menu.
    7. If necessary, choose Unicode (UTF-8) from the Character Set Encoding pop-up menu.

Note: If you are using tcsh or bash, make sure that "Escape 8 bit characters with Ctrl-V" is selected in the Emulation pane of the Terminal Inspector. If you are using zsh, make sure that "Escape 8 bit characters with Ctrl-V" is not selected. You can then drag/type names of folders with high-bit characters correctly. (tcsh/bash will show the escaped form of the character; zsh will show the actual character.)
注意:
如果你是使用tcsh 或是 bash 那"Escape 8 bit characters with Ctrl-V"選項就必須選取,但是如果你是使用zsh,那就不要選取"Escape 8 bit characters with Ctrl-V"選項。

標籤: ,

2007年6月14日 星期四

利用 終端機 刪除多個資料夾內的檔案

之前在mac u know裡面看到了這篇文章
正好想到可以用在一些重覆性多的檔案裡面
之前正好wow的ui裡面的板本修改裡面可以用到
能夠一次把wow ui裡面的lua檔一次一起找出來
然後再進行版本的修改就好了- -b
enjoy it~
由 hanzo 在 週五, 2007-04-06 15:51 提供

有時候隨身碟放了一些照片,然後這個隨身碟又借給了一些使用Windows的朋友,Windows系統在看過圖片後,都會在圖片的資料夾產生 Thumbs.db的檔案,如果資料夾很多,這些檔案看到就很頭痛了,利用find的指令能一次清掉這些惱人的檔案,例如你的隨身碟名稱為1G

首先開一個終端機,然後到/Volumes/1G,指令如下

cd /Volumes/1G

接著輸入

find ./ -name Thumbs.db -exec rm -rf {} \;

如果你只是要看哪些資料夾有Thumbs.db,你可以輸入

find ./ -name Thumbs.db

文章是來自
http://www.macuknow.com/node/93
MACUKNOW

所以簡單的說在終端機上面找到wow的資料夾
比如/wow/interface/addones/的位置輸入

find ./ -name *.lua

就可以找到所有的lua檔的位置了~
不過要怎麼同時更改內容就................默....

標籤: , ,

在 Mac 的終端機(terminal)中使用中文

這篇文章是讓大家透過一些設定就可以讓terminal可以顯示中文
裡面有提到一些設定的東西,我就在這邊解譯一下
主要是藉由修改 bash 命令列編輯界面 readline 的設定來解決這問題。readline 的啟動檔是 .inputrc,bash 啟動時,會先讀取這份啟動檔,並套用當中的設定。

然後在文中還有提到一點就是 alias 他只是個很簡單的重新命名,
把 ls 重新定義為 ls -v
enjoy it~:)
相信許多像我一樣從 Linux 轉到 Mac 的使用者,即使到了 Mac 上還是喜歡用 terminal 來作些事情,但是也會像我一樣,馬上發現在 Mac 的 terminal 中沒辦法看到中文,也沒辦法輸入中文,不使用內建的終端機.app,換用 iTerm 也無法解決這個問題。

我本來也以為這是個無解的問題,後來無意中 Google 了一下,發現其實是有解的,而且其實只是設定上的問題而已。不過雖說是設定上的問題,但是這些設定卻不是針對終端機程式,而是環境變數。

請在家目錄中新增一個 .profile 檔,內容如下:

alias ls="ls -v"


這樣一來就可以在 ls 的時候看見中文。

然後另外再新增一個 .inputrc 檔,內容如下:

set convert-meta off
set meta-flag on
set output-meta on


這樣就可以順利的輸入中文。

詳細的變數意義,我想有興趣的人就自己 man 或 Google 一下吧,使用 Linux 最應該學到的應該就是自己找資料的本事不是嗎 :)

posted by Shiva Huang at 2:59 上午

原作者文章
http://blog.lifestyle.idv.tw/2007/01/develope-mac-terminal.html
apple developer"s coffe shop

標籤: , ,