Last active
          March 11, 2016 20:20 
        
      - 
      
- 
        Save stevekuznetsov/700c4df5d18061822868 to your computer and use it in GitHub Desktop. 
    messing with lines
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/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