![]() If the file of interest is an executable, your application might want to simply launch it. For instance, your application might want to launch another application that allows the user to modify a data file. A Ruby script that knows how to run itself through three interpreters.Once your application has located a file object, the next step is often to act on it in some way. Then on into the actual Ruby portion of the script. The #! line starts with a # turning it into a comment. And then does nothing with that hash containing the string because it sits on the right side of an || with an always true item :"" on the left. So the hieroglyphs handily wrap all the Windows Command Shell and sh/bash pieces into a string to avoid parsing it as Ruby. Let’s bring back the whole thing and interpret it like Ruby. ” That is not run by sh/bash because of the exec, but is present as a parsible thing that is meaningful for the Ruby interpretation of this file.īut wait … again … this file is interpreted by Ruby with the -x switch so that all of these lines are ignored, aren’t they? is “all the parameters from the command line.”Īnd because this was run with exec, thus endeth the sh/bash interpretation of this file."$0" is as before but very specifically this file passed in as the input to be interpreted by Ruby.-x again, “Dear Ruby, please ignore all the shenanigans above #!.”.(Remember, these binstubs exist in RubyInstaller in the same directory as the installed ruby.exe executable.) "$bindir/ruby" is how Ruby gets executed, having determined the location of the current file in the line before. ![]() This is what stops the sh/bash execution of the current script and runs it in Ruby instead.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |