如何重置/清除erlang终端 [英] How do I reset/clear erlang terminal

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

问题描述

我正在尝试提示复位,忘记所有的变量,并从第一行开始提示>

我知道以下内置函数

  f()。 %%忘记所有
io:format(\e [H \e [J])。 %%清除屏幕,并将光标移动到行开始

但是当我写以下命令,它会忘记所有的变量,但它不会重置屏幕,只需清除屏幕,如终端中的清除命令。



在Linux中,我只需键入 reset ,但是我找不到等效命令或内置函数为erlang要做到这一点。



我还尝试过 io:format(os:cmd(reset))但是我收到错误。



我现在的解决方案是退出erlang终端,并重新打开,但我确定有更简单的方法来做到这一点。

解决方案

有一些这样的方法,只需要通过按ctrl来启动一个新的shell -g然后 s c

  $ erl 
Erlang / OTP 18 [erts-7.3] [source-d2a6d81] [64位] [smp:8:8] [异步线程:10] [hipe] kernel-poll:false]

Eshell V7.3(中止与^ G)
1> A = 1.
1
2>
用户切换命令
- > s
- > c
Eshell V7.3(中止与^ G)
1> A.
* 1:变量'A'是未绑定的
2>

当然不清楚屏幕。你必须使用自己的控制台机制(我在OSX上使用iTerm,我只是点击 cmd-k


I'm trying to get the prompt reset, forget all the variables and start the prompt from line 1>
I'm aware of the following built-in functions

f().                      %% forget all
io:format("\e[H\e[J").    %% "clear screen" and moving cursor to the begin of the line

but when I'm writing the following commands, it does forget all the variables, but it doesn't "reset" the screen, just clear the screen, like clear command in the terminal.

in Linux, I just type reset, but I couldn't find equivalent command or built in function for erlang to do that.

I also tried io:format(os:cmd("reset")). but I received error.

my solution for now is to quit the erlang terminal, and reopen it again, but I'm sure there is much easier ways to do that.

解决方案

A somewhat tricky way to do it would be to just start a new shell by pressing ctrl-g and then s, c

$ erl
Erlang/OTP 18 [erts-7.3] [source-d2a6d81] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.3  (abort with ^G)
1> A = 1.
1
2>
User switch command
 --> s
 --> c
Eshell V7.3  (abort with ^G)
1> A.
* 1: variable 'A' is unbound
2>

Of course that doesn't clear the screen. You have to use your own console mechanisms for that (I use iTerm on OSX and I just hit cmd-k for that)

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

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