Find the answer to your Linux question:
Results 1 to 5 of 5
When i save my script as name.rb using kate and then go to the konsole term and type in ruby name.rb the script wont run. I had unix for a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2004
    Posts
    44

    saving and running ruby scripts


    When i save my script as name.rb using kate and then go to the konsole term and type in ruby name.rb the script wont run. I had unix for a short period of time before installing linux and it worked perfectly. I cant figure this one out i got ruby installed i got the text editor i write the script and save it as name.rb. Yet when i go to the konsole and type in ruby name.rb it says file not found. Anyone know how to fix this? i have suse pro 9.0 if it helps.

  2. #2
    Just Joined!
    Join Date
    Mar 2004
    Posts
    30
    At the top of the script make sure you have the shebang correct:

    #!/usr/local/bin/ruby

    or just use

    ruby prog.rb

    done.

    I tend to use perl and python myself... I can never find a machine with ruby installed... including my own.


    Richard

  3. #3
    Just Joined!
    Join Date
    May 2004
    Posts
    44
    ruby prog.rb is what i was doing and it wasnt working( was telling me could not find file). The shebang i couldnt figure out how to change it(on unix it was automated i guess so i never bothered). So assuming changing the shebang is the answer how would i change it to what you typed.

  4. #4
    Just Joined!
    Join Date
    May 2004
    Posts
    44
    i logged in as the root user and ruby scripts ran perfectly. I dont know exactly why it works on root and not on the other user but all my problems are solved even if i figured out the answer by accident heh.

  5. #5
    Just Joined!
    Join Date
    Mar 2004
    Posts
    30
    Sounds like a permission problem. To allow others to execute it

    chmod 0644 name.rb

    ruby name.rb

    or

    chmod 0755 name.rb

    ./name.rb

    Richard

Posting Permissions

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