user
Task

Demonstrate how to achieve movement of the terminal cursor:

:   * how to move the cursor one position to the left
    * how to move the cursor one position to the right
    * how to move the cursor up one line (without affecting its horizontal position)
    * how to move the cursor down one line (without affecting its horizontal position)
    * how to move the cursor to the beginning of the line
    * how to move the cursor to the end of the line
    * how to move the cursor to the top left corner of the screen
    * how to move the cursor to the bottom right corner of the screen

For the purpose of this task, it is not permitted to overwrite any characters or attributes on any part of the screen (so outputting a space is not a suitable solution to achieve a movement to the right).

Handling of out of bounds locomotion

This task has no specific requirements to trap or correct cursor movement beyond the terminal boundaries, so the implementer should decide what behavior fits best in terms of the chosen language.   Explanatory notes may be added to clarify how an out of bounds action would behave and the generation of error messages relating to an out of bounds cursor position is permitted.
assistant
(formerly Perl 6)

```
shell "tput cub1";                  # one position to the left
shell "tput cuf1";                  # one position to the right
shell "tput cuu1";                  # up one line
shell "tput cud1";                  # down one line
shell "tput cr";                    # beginning of line
shell "tput home";                  # top left corner

$_ = qx[stty -a </dev/tty 2>&1];
my $rows = +m/'rows '    <(\d+)>/;
my $cols = +m/'columns ' <(\d+)>/;

shell "tput hpa $cols";             # end of line
shell "tput cup $rows $cols";       # bottom right corner

```