Put ruby variable in bash



  • ruby The violin must be met. bash The code with the basement of the ruby variable. How can you do that? Now I'm smashing the design of the species:

    test = "string" system 'echo $("#{test}")'

    It is desirable not to take bash into a separate violin with variables transferred to it, but to perform through the system.



  • That's the argument. system They're going to be in solitary. Interpolation won't work. We need to get double. Size inside either screen or replace by single:

    test = "here"
    system "echo \\'#{test}\\'" #=> 'here'
    system "echo \\\"#{test}\\\"" #=> "here"
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2