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 7858209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:19:12+00:00 2026-06-02T21:19:12+00:00

I expected these values to match. They did not match when the shell script

  • 0

I expected these values to match. They did not match when the shell script exited due to some error condition (and thus returned a non-zero value). Shell $? returned 1, ruby $? returned 256.

>> %x[ ls kkr]
ls: kkr: No such file or directory
=> ""
>> puts $?
256
=> nil
>> exit
Hadoop:~ Madcap$ ls kkr
ls: kkr: No such file or directory
Hadoop:~ Madcap$ echo $?
1 
  • 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-02T21:19:13+00:00Added an answer on June 2, 2026 at 9:19 pm

    In Ruby $? is a Process::Status instance. Printing $? is equivalent to calling $?.to_s, which is equivalent to $?.to_i.to_s (from the documentation).

    to_i is not the same as exitstatus.

    From the documentation:

    Posix systems record information on processes using a 16-bit integer.
    The lower bits record the process status (stopped, exited, signaled)
    and the upper bits possibly contain additional information (for
    example the program’s return code in the case of exited processes).

    $?.to_i will display this whole 16-bit integer, but what you want is just the exit code, so for this you need to call exitstatus:

    $?.exitstatus
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a published list of expected values by SQL Server version that match
Getting Expected ',' or '{' but found '#44559' error. My code looks like this:
I keep getting an expected identifier error at this line in my code =/
I am trying to match clicked linked path with other links. It does not
I'm not so good with regex, and need some help. I have a string
Background I have the following function, which ranks results by how closely they match
I'm trying to get some regex to parse some values stored in a set
I was doing some unit testing at work and a peculiar error popped up
Expected Outcome: Successful installtion of Plone 4.1.4 Actual Outcome: Installation fails with: libxml2: cmmi
Expected output & output I get in debug mode, and release mode under VS2010,

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.