[erlang-questions] Deleting last line in the Erlang Shell

Torbjorn Tornkvist <>
Wed Apr 25 21:29:23 CEST 2007


Jordan Wilberding wrote:
> The \r doesn't seem to do anything in Erlang. Any other ideas?

Try this program, like this: erl -noshell -s abc
-------------------------------------------
-module(abc).
-export([start/0]).
start() ->
     [print(integer_to_list(I)) || I <- [1,2,3,4,5,6,7,8,9]], erlang:halt().
print(S) -> io:format([13|S], []), timer:sleep(1000).
---------------------------------------------

Cheers, Tobbe



> 
> Thanks!
> Jordan Wilberding
> 
> Mazen Harake wrote:
>> This reply is getting ugly... sorry for spaming your inboxes!
>>
>> the correct line should be
>>
>> io:format("\r")
>>
>> Cheers!
>>
>> Mazen wrote:
>>   
>>> Maybe an ugly way of doing it but on top of my head you can do
>>>
>>> io:format("r")
>>>
>>> which will bring you back on the same line (which you can then overwrite). Don't know if the there is a special way to do it. I have never actually done an command line interactive program in Erlang myself :)
>>>
>>>
>>> Guest wrote:
>>> Hello,
>>>
>>> I have a simple program that takes input via io:get_line/1 in a loop.
>>>
>>> However, when I hit enter I would like for it to just clear the line
>>> instead of printing a new input line. Is there any way to do this with
>>> in the erlang shell?
>>>
>>> Thanks!
>>> Jordan Wilberding
>>> _______________________________________________
>>> erlang-questions mailing list
>>> 
>>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>>  Post recived from mailinglist
>>> (end of quote)
>>>
>>> _________________________________________________________
>>> Post sent from http://www.trapexit.org
>>> _______________________________________________
>>> erlang-questions mailing list
>>> 
>>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>>   
>>>     
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>   
> 




More information about the erlang-questions mailing list