

I find it odd that it would support colored text via ANSI escape codes, but not cursor repositioning through the exact same technology. I’ve been searching everywhere, but haven’t found anything relevant to Terminal.app, specifically. Is there a reason for this, aside form Terminal.app simply lacking support for these codes? Is there a way to enable this functionality? Is there a chance I have something misconfigured? My TERM setting? Something else? What I see in Terminal.app, however, is this: Hello worldG'day Indeed, this is exactly what I get with iTerm2.app, ConEmu for Windows (running either MinGW or MSYS Git’s copy of bash.exe), etc. As a result of running the script above, I’d expect the five characters in “G'day” to overwrite the five characters of “Hello” after the cursor has been repositioned, producing the following: G'day world

For example, what I want to do is something like this: echo -e "\033[sHello world\033[uG'day"ĮSC[s Saves the current cursor position, whereas ESC[u restores the last saved position. Unfortunately, that type of code doesn’t seem to work too well in Terminal.app, from what I’ve been able to gather. However, I’m more interested in the cursor location manipulation functionality afforded by ANSI escape codes.
#Ansi escape sequences explained mac os
I notice that with the TERM environment variable set to either xterm or xterm-256color that Mac OS X’s Terminal.app utility respects most ANSI escape codes, as least when those escape codes pertain to changing text color.įor example: echo -e "\033[0 31mERROR:\033[0m It worked"
