SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Invoking an executable of /usr/bin from a Ruby script

    Hello,

    I try to call "/usr/bin/openssl version" from a Ruby script, but without success. It does work from my shell:

    $ openssl version
    OpenSSL 0.9.7l 28 Sep 2006

    but running this Ruby script:

    Code Ruby:
    puts %x{"/usr/bin/openssl version"}

    I get the error "sh: /usr/bin/openssl version: No such file or directory", even if I put "/usr/bin" in $:

    Code Ruby:
    $:.push("/usr/bin/")
    puts %x{"/usr/bin/openssl version"}

    Any clue? Thanks by advance

    Florent

  2. #2
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't need the quotes. This works for me:

    Code Ruby:
    #!/usr/bin/ruby
    puts %x{openssl version}

  3. #3
    SitePoint Member
    Join Date
    Mar 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you devbanana! Without the quotes it works


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •