This is probably common knowledge to the big guns but this is for newbies...
This is a demo using simple plot function using bash.
In a default Terminal...
It clears the window, sets the cursor to the top left hand corner, draws a triangle inside the window, writes a string inside the triangle and resets the command prompt at the top left hand corner and finally stops...
#!/bin/bash
# $VER: plot.sh_Version_0.00.10_Public_Domain_2013_B.Walker.
# A means of shifting the cursor and text printing at the same time inside one function.
# Positional _plot_ function...
plot() { printf "\x1B["$vert";"$horiz"f$char" ; }
# A simple clear screen function just for added fun...
# I know, I KNOW, I can use clear but that defeats the reason for this plot function!
clrscn()
{
for vert in $( seq 1 64 )
do
printf "\n"
done
# Set the cursor to the top left hand corner.
horiz=1
vert=1
char=""
# Now use plot with its required _arguments_ after the function call.
plot $vert $horiz $char
}
clrscn
# Just a delay, nothing more...
sleep 1
# Draw a tringle upwards slope.
horiz=20
char="*"
for vert in $( seq 22 -1 2 )
do
# Remember; _arguments_ added after the function call...
plot $vert $horiz $char
horiz=$[ ( $horiz + 1 ) ]
done
# Shift back 1 horizontal position for triangle apex...
horiz=$[ ( $horiz - 1 ) ]
# Now draw the the triangle's downards slope.
for vert in $( seq 2 1 22 )
do
plot $vert $horiz $char
horiz=$[ ( $horiz + 1 ) ]
done
# Draw the triangle's bottom line...
horiz=21
vert=22
char="***************************************\n"
plot $vert $horiz $char
# Finally write a string inside the triangle.
horiz=24
vert=21
char="Plotting and drawing the easy way.\n\n\n"
plot $vert $horiz $char
# Place the command prompt at the top...
horiz=1
vert=1
char=""
plot $vert $horiz $char
# Plot function end...