簡體   English   中英

從命令行執行ruby的參數列表

[英]list of arguments for executing ruby from command line

我正在從命令行中閱讀運行ruby的內容,結果發現: 如何在Windows 7上運行ruby程序?

答案之一說

紅寶石命令的一般形式是:

紅寶石[紅寶石選項] [程序名稱] [程序選項]

我嘗試在網上尋找這些[紅寶石選項],但找不到任何。 你們有這些紅寶石選項的列表或至少有用的鏈接嗎?

打開命令提示符並輸入ruby -h ,將得到以下所有信息:

C:\>ruby -h
Usage: ruby [switches] [--] [programfile] [arguments]
  -0[octal]       specify record separator (\0, if no argument)
  -a              autosplit mode with -n or -p (splits $_ into $F)
  -c              check syntax only
  -Cdirectory     cd to directory, before executing your script
  -d              set debugging flags (set $DEBUG to true)
  -e 'command'    one line of script. Several -e's allowed. Omit [programfile]
  -Eex[:in]       specify the default external and internal character encodings
  -Fpattern       split() pattern for autosplit (-a)
  -i[extension]   edit ARGV files in place (make backup if extension supplied)
  -Idirectory     specify $LOAD_PATH directory (may be used more than once)
  -l              enable line ending processing
  -n              assume 'while gets(); ... end' loop around your script
  -p              assume loop like -n but print line also like sed
  -rlibrary       require the library, before executing your script
  -s              enable some switch parsing for switches after script name
  -S              look for the script using PATH environment variable
  -T[level=1]     turn on tainting checks
  -v              print version number, then turn on verbose mode
  -w              turn warnings on for your script
  -W[level=2]     set warning level; 0=silence, 1=medium, 2=verbose
  -x[directory]   strip off text before #!ruby line and perhaps cd to directory
  --copyright     print the copyright
  --version       print the version

奧雅納的答案已經給出了一些,但請參見此處 即,這是奧雅納的答案中缺少的那些:

-h   Displays an overview of command-line options.
-K [ kcode] Specifies the multibyte character set code (e or E for EUC (extended Unix code); s or S for SJIS (Shift-JIS); u or U for UTF-8; and a, A, n, or N for ASCII).
-X dir   Changes directory before executing (equivalent to -C).
-y   Enables parser debug mode.
--debug  Enables debug mode (equivalent to -d).
--help   Displays an overview of command-line options (equivalent to -h).
--verbose    Enables verbose mode (equivalent to -v). Sets $VERBOSE to true
--yydebug    Enables parser debug mode (equivalent to -y).

這是Ruby的命令行選項:

Usage: ruby [switches] [--] [programfile] [arguments]
-0[octal]       specify record separator (\0, if no argument)
-a              autosplit mode with -n or -p (splits $_ into $F)
-c              check syntax only
-Cdirectory     cd to directory, before executing your script
-d              set debugging flags (set $DEBUG to true)
-e 'command'    one line of script. Several -e's allowed. Omit [programfile]
-Eex[:in]       specify the default external and internal character encodings
-Fpattern       split() pattern for autosplit (-a)
-i[extension]   edit ARGV files in place (make backup if extension supplied)
-Idirectory     specify $LOAD_PATH directory (may be used more than once)
-l              enable line ending processing
-n              assume 'while gets(); ... end' loop around your script
-p              assume loop like -n but print line also like sed
-rlibrary       require the library, before executing your script
-s              enable some switch parsing for switches after script name
-S              look for the script using PATH environment variable
-T[level=1]     turn on tainting checks
-v              print version number, then turn on verbose mode
-w              turn warnings on for your script
-W[level=2]     set warning level; 0=silence, 1=medium, 2=verbose
-x[directory]   strip off text before #!ruby line and perhaps cd to directory
--copyright     print the copyright
--version       print the version

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM