Emojis - Ruby Command Line Options ๐Ÿ–ฅ️ for ICM InfoWorks Ultimate

 Command Line Options ๐Ÿ–ฅ️

Ruby interpreter accepts the following command-line options (switches). They're largely similar to Perl's options.

  • -0digit ๐Ÿ“–

    • Sets the input record separator ($/) as an octal number. No digits mean the null character is the separator. -00 initiates Ruby's paragraph mode. -0777 makes Ruby process an entire file as one string.
  • -a ๐Ÿš€

    • Activates auto-split mode with -n or -p. In this mode, Ruby runs $F = $_.split at the start of each loop.
  • -c

    • Ruby checks the script's syntax and exits. If there's no error, "Syntax OK" is displayed.
  • -Kc ๐Ÿˆธ

    • Defines KANJI (Japanese character) code-set.
  • -d, --debug ๐Ÿ”

    • Enables debug mode. $DEBUG is set to true.
  • -e script ๐Ÿ“œ

    • Takes script from the command-line. Ruby won't look for a script filename in the arguments with this switch.
  • -F regexp ๐Ÿ”—

    • Determines input field separator ($;).
  • -h, --help

    • Shows a summary of the options.
  • -i extension ๐Ÿ“

    • Specifies in-place-edit mode. If provided, the extension is added to the old filename for backup.

    Example:

    % echo matz > /tmp/junk % cat /tmp/junk matz % ruby -p -i.bak -e '$_.upcase!' /tmp/junk % cat /tmp/junk MATZ % cat /tmp/junk.bak 
    matzk.bak matz
  • -I directory ๐Ÿ“‚

    • Tells Ruby where to load library scripts. This path is added to the load-path variable ($:).
  • -l ๐Ÿ”š

    • Enables automatic line-ending processing. It sets $\ to the value of $/ and uses chop! on every line when used with -n or -p.
  • -n ๐Ÿ”„

    • Makes Ruby assume a loop around your script, similar to sed -n or awk.
  • -p ๐Ÿ–จ️

    • Similar to -n, but prints the value of variable $_ at each loop's end.
  • -r filename ๐Ÿ“

    • Requires Ruby to load the file. Useful with -n or -p switches.
  • -s ๐Ÿ”„

    • Enables parsing for switches after the script name but before any filename arguments.
  • -S ๐Ÿ”

    • Makes Ruby use the PATH environment variable to search for the script.
  • -T [level] ๐Ÿ›ก️

    • Enables "taint" checks. If a level is specified, it sets $SAFE to that level.
  • -v, --verbose ๐Ÿ—ฃ️

    • Enables verbose mode. Ruby will print its version at the start.
  • --version ๐Ÿ†š

    • Displays Ruby's version.
  • -w ๐Ÿ“ข

    • Enables verbose mode without the version message. Sets $VERBOSE to true.
  • -x[directory] ๐Ÿ—บ️

    • Indicates the script is embedded in a message.
  • -X directory ๐Ÿ—บ️

    • Makes Ruby switch to the specified directory.
  • -y, --yydebug ๐Ÿ›

    • Enables compiler debug mode. Useful for debugging the Ruby interpreter itself.

Parent topic: ICM Exchange for Autodesk ⚙️๐Ÿ”„