Ruby command line options

Ruby is for the most part kept running from the order line as follows:

$ ruby [ alternatives ] [.] [ programfile ] [ contentions ... ]

interpreter can be called with the accompanying alternatives to control nature and conduct of the mediator.

-a When utilized with - n or - p, you can turn on auto split mode. Look at the - n and - p alternatives.
-c Checks just the punctuation and does not execute the program.
-C dir Change the catalog before execution (equal to - X).
-d Enable investigate mode (equal to - troubleshoot).
-F pat Specify pat as the default split mode ($;).
-e prog Specifies that prog is executed as a program on the direction line. Different - e alternatives can be determined to execute various projects.
-h Displays a diagram of the order line choices.
-I [ ext] Rewrites the substance of the record to program yield. The first document will be spared with the augmentation ext. In the event that ext isn't indicated, the first record will be erased.
-I dir Add dir as the registry to stack the library.
-K [ kcode] Specifies multi-byte character set encoding. e or E relates to EUC (expanded Unix code), s or S relates to SJIS (Shift-JIS), u or U compares to UTF-8, and an, A, n or N relates to ASCII.
-l Enable programmed end-of-line preparing. Drop a newline from the info line and attach a newline to the yield line.
-n Place the code in an info circle (simply like in while gets; ... end).
-0[ octal] Set the default record separator ($/) to octal. On the off chance that octal isn't indicated, the default is \0.
-p Place the code in an info circle. The estimation of the variable $_ is yield after every cycle.
-r lib Use require to stack lib as a pre-execution library.
-s Interpret the match design between the program name and the record name parameter - any parameter of - xxx as a switch and characterize the comparing variable.
-T [level] Set the security level and play out a contamination test (if no dimension is indicated, the default esteem is 1).
-v Displays the form and empowers excess mode.
-w Enables excess mode. In the event that the program document isn't determined, it is perused from STDIN.
-x [dir] Delete the content before the #!ruby line. In the event that dir is determined, change the index to dir.
-X dir Change the index before execution (identical to - C).
-y Enable parser troubleshoot mode.
- - copyright Display the copyright take note.
- - debug Enable investigate mode (comparable to - d).
- - help Displays a diagram of the order line choices (proportional to - h).
- - version Shows the variant.
- - verbose Enable repetition mode (comparable to - v). Set $VERBOSE to genuine.
- - yydebug Enable parser investigate mode (comparable to - y).

One-character direction line alternatives can be joined. The accompanying two lines express the equivalent meaning:

$ ruby -ne 'print if /Ruby/' /usr/share/bin

$ ruby -n -e 'print if /Ruby/' /usr/share/bin

welookups is optimized for learning.© welookups. 2018 - 2019 All Right Reserved and you agree to have read and accepted our term and condition.