How to make the say command echo a variable value in a script?

后端 未结 2 1512
被撕碎了的回忆
被撕碎了的回忆 2021-01-28 10:17

I\'m on a Mac and sometimes I use the say command at the end of my scripts, like so:

system(\'say \"Finished successfully\"\')

But

2条回答
  •  长情又很酷
    2021-01-28 10:48

    Remove backticks (Kernel#`):

    system("say \"#{my_variable}\"")
    

    or

    system("say '#{my_variable}'")
    

提交回复
热议问题