Question

Can you bit help me to understand how the below options work in real life?

  • -T [level]
  • -K [kcode]
  • -F pat
  • -i [ext]
Was it helpful?

Solution

I found the following resource, which may help you, and I'll just rip the quotes from the page to answer your question, after taking a real quick crack at a summary of your question.

The -T option is related to the security level of your Ruby script, while the -k, refers to the character code set used. The -F is used for pattern matching, and finally, the -i is used to edit arguments to your code. I will now quote the relevant parts to give you a bit more information:

-T[level} Sets the safe level, which among other things enables tainting checks .. This is basically a security level with a few options, see 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 Specifies the code set to be used. This option is useful mainly when Ruby is used for Japanese-language processing. kcode may be one of: e, E for EUC; s, S for SJIS; u, U for UTF-8; or a, A, n, N for ASCII.

-F pattern Specifies the input field separator ($;) used as the default for split() (affects -a).

-i [extension} Edits ARGV files in place. For each file named in ARGV, anything you write to standard output will be saved back as the contents of that file. A backup copy of the file will be made if extension is supplied.

Hope that helps a bit. CHEERS!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top