Exporting an Environment Variable in Ruby

后端 未结 4 1158
忘掉有多难
忘掉有多难 2020-11-30 03:15

How do I export an environment variable from within a Ruby script to the parent shell? For example, implementing a naïve implementation of the read Bash builtin

4条回答
  •  春和景丽
    2020-11-30 03:49

    Simple answer: You can't.

    Longer answer: You can't, unless the operating environment provides hooks to do so. Most do not. The best you can usually do is print out the assignments you want done and have the parent execute them.

提交回复
热议问题