I'm not 100% sure of your use case, but I can tell you these:
system will run a shell command, and return success/failure, but won't save the results:
irb(main):001:0> x = system('uname')
Linux
=> true
irb(main):002:0> x
=> true
Backticks will run the shell command and save the output, but don't require the word system:
irb(main):003:0> x = `uname`
=> "Linux\n"
irb(main):004:0> x
=> "Linux\n"
(If you include "system" inside the backticks it will run "system" on the command line; usually not what you want)
Backticks alone don't do anything inside strings:
irb(main):005:0> "I am `uname`"
=> "I am `uname`"
But they will be expanded with #{} inside double quotes:
irb(main):006:0> "I am #{`uname`}"
=> "I am Linux\n"
But it's usually better to run the command first, check for errors, and then add it to the string, like
result = `uname`
# Check for errors here
output = "context #{result} more context"
myuser? What exactly are you running? What result do you get? What are you expecting/hoping for? Can you provide a minimal reproducible example of the problem?%2Bmeans nothing to Ruby. Why isevalnecessary here?systemcommand via a string interpolation?" ... The answer is you can't, as this would be a gigantic security vulnerability if it were possible. (You could just enter"`system(rm -rf /)`"as the parameter!!!) If you want to trigger a system call, then you need to do this explicitly in the ruby code, and with great caution.