Created
April 12, 2014 05:25
-
-
Save hamidreza-s/10520105 to your computer and use it in GitHub Desktop.
How to clear the Erlang shell.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% move cursor to beginning of the line | |
io:format("\e[H"). | |
%% clear the console | |
io:format("\e[J"). | |
%% both | |
io:format("\e[H\e[J"). |
after running some code later, everything that was cleared is revealed again
this actually causes the shell to emit ansi/vt control codes, where the user's terminal may or may not choose to respond. that's why scrolling "fixes" it, is that erlang has no idea that happened, and is faithfully repainting.
you can verify by setting your interpreter to dumb tty and trying this. nothing will happen.
io:format(os:cmd(clear)).
congrats tudrax
io:format(os:cmd(clear)) works!!!!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@laxmikantG Use the output of os:cmd("clear").
For me, io:format("\e[H\e[2J").