如何清除 Ruby 中的终端? [英] How can I clear the terminal in Ruby?

查看:43
本文介绍了如何清除 Ruby 中的终端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在 Ruby 中做我可以用 C 中的 system("clear") 做的事情.我写了一个像

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")

我希望在执行此命令后清除控制台,但它不起作用.

I want the console to be cleared after executing this commnad, but it is not working.

推荐答案

如果你想要一些模糊便携的东西,你可以尝试:

If you want something that is vaguely portable you can try:

system "clear" || system "cls"

将尝试 clearcls

这篇关于如何清除 Ruby 中的终端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆