Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8064135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:16:35+00:00 2026-06-05T11:16:35+00:00

I have written a ruby script that then calls another ruby script. The callee

  • 0

I have written a ruby script that then calls another ruby script. The callee script is very long and has a lot of “gets” for input.

So what I do is open my unix terminal, call the caller script, which then does this simple line:

load "calleeScript.rb"

The calleeScript.rb has been simplified to just do this:

input = gets.chomp

print input

But it just gives me an error, like it can’t handle gets. The error says:

./getsTest.rb:3:in `gets’: No such file or directory – 5 (Errno::ENOENT)
from ./getsTest.rb:3

Even if I take out that gets it won’t print/puts to the terminal. So any idea how I call one script that then calls another script (either relinquishing total control or forking), do some inputs/outputs, and still return to the previous script?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:16:37+00:00Added an answer on June 5, 2026 at 11:16 am

    Kernel#gets is a convenience method that allows you to handle input both via standard input and via files.

    If you call your script without any arguments, i.e. like this:

    getsTest.rb
    

    Then Kernel#gets reads its input from standard input. If, however, you call your script like this:

    getsTest.rb foo.txt
    

    Then Kernel#gets reads its input from a file named foo.txt.

    In your case, Kernel#gets is complaining that it can’t find a file named 5, so presumably you called your script something like this:

    getsTest.rb 5
    

    If you want to read from some specific source, you should call IO#gets on that specific source. I suggest calling

    $stdin.gets
    

    Note: technically speaking, this is not a feature of Kernel#gets but rather of the ARGF magic constant. Basically, Kernel#gets just calls ARGF.gets.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently written some complex ruby script that eventually fails with segfaults in
I have a specific script written in Ruby that needs root privileges. Most of
I have this code that I have written in Ruby, but when trying to
I have a UI Automation script, written in JavaScript. From that script, how do
I have written a ruby script to screen scrape something using the 'open-uri' and
I have written a ruby script which opens up dlink admin page in firefox
I have a script written in ruby. I need to remove any duplicate newlines
Suppose I have a script written in Python or Ruby, or a program written
I have writen a ruby script that requires config/environment.rb so I can use all
I have a daemon script written in ruby which responds to commands like daemon

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.