JRUBY(1)
π JRUBY π
okay so bestie, welcome to the jruby(1) page β it lives in the LOCAL manual, section 1, and it's literally your group chat invite to the coolest thing ever. grab a boba, sit down, we're doing this π«Ά
β¨ NAME β¨
jruby β an interpreted object-oriented scripting language. that's it, that's the whole vibe. iconic behavior fr fr π
πΈ SYNOPSIS πΈ
jruby [--copyright] [--version] [-Sacdlnpswvy] [-0[octal]]
[-C directory] [-F pattern] [-I directory] [-K c] [-T[level]]
[-e command] [-i[extension]] [-r library] [-x[directory]] [--]
[program_file] [argument ...]
lowkey a lot of little letters but don't panic, we're gonna go through every single one π
π¦ DESCRIPTION π¦
Jruby is a 100% pure-Java implementation of Ruby, which is an interpreted scripting language built for quick and easy object-oriented programming. it's giving "I can do anything" energy β¨
it has so many features for processing text files and doing system management tasks (literally like Perl, if you know, you know), and it's simple, straight-forward, and extensible. the way that it just *works*β¦ obsessed ππ
π OPTIONS π
so the Ruby interpreter accepts these command-line options (switches), and ngl they're quite similar to the ones in perl(1). every single one, coming right up π
--copyrightβ prints the copyright notice. legal girlies rise π«Ά--versionβ prints the version of the Ruby interpreter.-0[octal]β (that's the digit βzeroβ, not the letter, bestie π). this specifies the input record separator ($/) as an octal number. if no digit is given, the null character gets taken as the separator. other switches can follow the digits.-00turns Ruby into paragraph mode.-0777makes Ruby read the whole file at once as a single string, since there's no legal character with that value. wild, right?-C directoryβ causes Ruby to switch to the directory. we're moving, pack your bags π§³-F patternβ specifies input field separator ($;).-I directoryβ used to tell Ruby where to load the library scripts from. the directory path gets added to the load-path variable ($:).-K kcodeβ specifies KANJI (Japanese) encoding. ζ₯ζ¬θͺ girlies we see you πΈ-Sβ makes Ruby use thePATHenvironment variable to search for the script, unless its name begins with a slash. this is used to emulate#!on machines that don't support it, in the following manner:
#! /usr/local/bin/ruby
# This line makes the next one a comment in Ruby \
exec /usr/local/bin/ruby -S $0 $*
-T[level]β turns on taint checks at the specified level (default1). safety first babes π‘οΈ-aβ turns on auto-split mode when used with-nor-p. in auto-split mode, Ruby executes this at the beginning of each loop:
$F = $_.split
-cβ causes Ruby to check the syntax of the script and exit without executing it. if there are no syntax errors, Ruby will printβSyntax OKβto the standard output. the pre-game check we all need β¨-d,--debugβ turns on debug mode.$DEBUGwill be set totrue.-e commandβ specifies script from command-line while telling Ruby not to search the rest of the arguments for a script file name.-h,--helpβ prints a summary of the options. help me help you π«Ά-i extensionβ specifies in-place-edit mode. the extension, if specified, is added to the old file name to make a backup copy. for 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
matz
-lβ (that's the lowercase letter βellβ, okay, not a one π). enables automatic line-ending processing, which means to firstly set$\to the value of$/, and secondly chops every line read usingchop!.-nβ causes Ruby to assume the following loop around your script, which makes it iterate over file name arguments somewhat likesed -norawk:
while gets
...
end
-pβ acts mostly same as the-nswitch, but prints the value of variable$_at the each end of the loop. for example:
% echo matz | ruby -p -e '$_.tr! "a-z", "A-Z"'
MATZ
-r libraryβ causes Ruby to load the library usingrequire. it's useful when using-nor-p.-sβ enables some switch parsing for switches after the script name but before any file name arguments (or before a--). any switches found there get removed fromARGVand set the corresponding variable in the script. for example:
#! /usr/local/bin/ruby -s
# prints "true" if invoked with `-xyz' switch.
print "true\n" if $xyz
on some systems $0 does not always contain the full pathname, so you need the -S switch to tell Ruby to search for the script if necessary. this is to handle embedded spaces or such. a better construct than $* would be ${1+"$@"}, but it does not work if the script is being interpreted by csh(1). yeah. we know. π
-v,--verboseβ enables verbose mode. Ruby will print its version at the beginning, and set the variable$VERBOSEtotrue. some methods print extra messages if this variable is true. if this switch is given, and no other switches are present, Ruby quits after printing its version. she said bye then actually left π-wβ enables verbose mode without printing the version message at the beginning. it sets the$VERBOSEvariable totrue.-x[directory]β tells Ruby that the script is embedded in a message. leading garbage will be discarded until the first line that starts withβ#!βand contains the string,βrubyβ. any meaningful switches on that line will be applied. the end of script must be specified with eitherEOF,^D(control-D),^Z(control-Z), or the reserved word__END__. if the directory name is specified, Ruby will switch to that directory before executing the script. hidden treasure hunt energy πΊοΈβ¨-y,--yydebugβ turns on compiler debug mode. Ruby will print a bunch of internal state messages during compiling scripts. you don't have to specify this switch, unless you're going to debug the Ruby interpreter. > like fr, only the brave ones touch this one π₯
and that's the whole page, bestie!! every flag, every example, nothing skipped, no cap π β¨
cute little sign-off: this page comes from the UNIX manual, dated Apr 2, 2007, and yeah that's the vintage drop but it's still serving ππ¦ go write something iconic, you've got this ππ
π¦ where this page comes from
- debian bookworm: jruby 9.3.9.0+ds-8 Β· EPL-2.0 OR GPL-2.0-only OR LGPL-2.1-only
- debian trixie: jruby 9.4.8.0+ds-3 Β· EPL-2.0 OR GPL-2.0-only OR LGPL-2.1-only
- ubuntu noble: jruby 9.4.6.0+ds-1ubuntu3 Β· EPL-2.0 OR GPL-2.0-only OR LGPL-2.1-only
- ubuntu resolute: jruby 9.4.8.0+ds-3ubuntu1 Β· EPL-2.0 OR GPL-2.0-only OR LGPL-2.1-only
- ubuntu stonking: jruby 9.4.14.0+ds-1 Β· EPL-2.0 OR GPL-2.0-only OR LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms