Defining a variable from the command prompt

hello,
I have a script that sends emails out to my company, and I would like
to be able to run it by saying (from the command prompt):

sendemail.rb “this is my message”

then it would take “this is my message” and use that as @msg or
something. I know its possible, but I’m still pretty new to Ruby and not
sure how to do this.

Any help is appreciated!

Thanks,

  • Jeff M.

sendemail.rb “this is my message”

faq. research on ARGV

eg,

C:\family\ruby>cat test.rb
msg = ARGV[0] || “using default”
puts msg

C:\family\ruby>test.rb
using default

C:\family\ruby>test.rb “this is a test”
this is a test

kind regards -botp