How can I clear the terminal in Ruby?

前端 未结 15 1704
心在旅途
心在旅途 2020-11-30 06:14

I would like to know to how to do in Ruby what I can do with system(\"clear\") in C. I wrote a program like

puts \"amit\"
system(\"clear\")
         


        
15条回答
  •  日久生厌
    2020-11-30 06:58

    You can use following create a ruby file say check.rb like follwing

    puts "amit"
    #system "clear"
    

    and run it from console [Salil@localhost Desktop]$ check.rb

    o/p

    [Salil@localhost Desktop]$ ruby check.rb
    amit
    [Salil@localhost Desktop]$ 
    

    now modify check.rb and run it from console

    puts "amit"
    system "clear"
    

    o/p

    [Salil@localhost Desktop]$ 
    

提交回复
热议问题