2013-01-11 42 views
0

您能否幫我理解以下選項在現實生活中的工作方式?Ruby中的-T,-F,-K,-i命令行選項混亂

  • -T [level]
  • -K [kcode]
  • -F pat
  • -i [ext]
+1

你對他們感到困惑嗎? –

+0

我剛剛讀出了它們的定義,但它們的工作方式讓我感到困惑! –

+0

請幫忙嗎? –

回答

2

我發現下面的resource,它可以幫助你,我就從頁面抓取引號回答你問題,在對您的問題進行總結之後立即採取一些措施。

-T選項與您的Ruby腳本的安全級別相關,而 -k指的是使用的字符代碼集。 -F用於模式匹配,最後,-i用於編輯代碼的參數。我現在引述有關部分給你多一點信息:

-T [級別} 設置安全級別,除其他事項外使污點檢查.. 這基本上是一個安全級別有幾個選項見this

0 No checking of the use of externally supplied (tainted) data is performed. This 
    is Ruby's default mode. 
>= 1 Ruby disallows the use of tainted data by potentially dangerous operations. 
>= 2 Ruby prohibits the loading of program files from globally writable locations. 
>= 3 All newly created objects are considered tainted. 
>= 4 Ruby effectively partitions the running program in two. Nontainted objects may not 
    be modified. Typically, this will be used to create a sandbox: the program sets up 
    an environment using a lower$SAFE level, then resets $SAFE to 4 to prevent 
    subsequent changes to that environment. 

-K KCODE 指定要被使用的代碼。當Ruby用於日語處理時,此選項非常有用。 k代碼可以是以下之一:e,E代表EUC; S,S爲SJIS; U,U爲 UTF-8;或a,A,n,N代表ASCII。

-F pattern 指定用作split()(影響-a)的默認值的輸入字段分隔符($;)。

-i [擴展名] 編輯ARGV文件。對於在ARGV中命名的每個文件,您寫入標準 輸出的任何內容都將被保存爲該文件的內容。如果提供了擴展名,則會創建該文件的備份副本 。

希望能有所幫助。乾杯!

+0

我一直在尋找每個選項的小片段 - 這可以更好地理解! –