How do I use Ruby for shell scripting?

前端 未结 13 2008
粉色の甜心
粉色の甜心 2020-12-22 15:26

I have some simple shell scripting tasks that I want to do

For example: Selecting a file in the working directory from a list of the files matching some regular e

13条回答
  •  没有蜡笔的小新
    2020-12-22 16:06

    "How do I write ruby" is a little beyond the scope of SO.

    But to turn these ruby scripts into executable scripts, put this as the first line of your ruby script:

    #!/path/to/ruby
    

    Then make the file executable:

    chmod a+x myscript.rb
    

    and away you go.

提交回复
热议问题