Skip to content

Instantly share code, notes, and snippets.

@stevekuznetsov
Last active March 11, 2016 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevekuznetsov/700c4df5d18061822868 to your computer and use it in GitHub Desktop.
Save stevekuznetsov/700c4df5d18061822868 to your computer and use it in GitHub Desktop.
messing with lines
#!/bin/bash
# os::text::save_cursor saves the current cursor position if it is called in a TTY
# to allow us to provide os::text::clear_from_saved_cursor
function os::text::save_cursor() {
if [ -t 1 ]; then
tput sc
fi
}
# os::text::clear_from_saved_cursor clears all terminal contents from the last saved
# cursor if it is called in a TTY
function os::text::clear_from_saved_cursor() {
if [ -t 1 ]; then
tput rc
tput ed
fi
}
for (( i = 0; i < 10; i++ )); do
echo "interstitial line $i"
os::text::save_cursor
for (( j = 0; j < ${COLUMNS}; j++ )); do
for (( k = 0; k < "${ROWS}"; k++ )); do
echo -n "X"
done
done
os::text::clear_from_saved_cursor
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment