How to access ruby variable from inside backticks?

Say params[:host] returns a string. I want to pass this string to a ksh
script im trying to run from inside a ruby program.

for example,

ksh /path/to/script.ksh params[:host] #this doesn’t work.

The command takes params[:host] literally. I also tried:

host = params[:host]

ksh /path/to/script.ksh $host # $host is null I think.

How would I pass params[:host] to the ksh command?


How is Ruby supposed to know that you want to insert a variable? You
need string interpolation:

ksh /path/to/script.ksh #{params[:host]}