#!/bin/bash # brbash - Interactive simulation of a 64px heigth prompter, w/Utf8 braille font # (C) 2025 Felix Hauri - felix@f-hauri.ch # Usage: # brbash ["Quoted message to be prompted"] # Features: # - Auto-resize when resizing window # - Listen on file descriptor: `/proc/$pid/fd/10` to recieve new message # - If on XTerm, send "echo >/proc/$pid/fd/10 That\'s fun!" sample to clipboard # - Listen on user interactions: # `r` refresh display # `f` use `fortune` as new message # `n` prompt user for a new message # `l` replace message by process's current cpu load in percent, for 15 secs # `q` quit # - And some more... buildFont() { # Build two series of 4 arrays holding fonts from VGA font_8x16.c # This use two level loops: group:[ Even Odd ], line:[ 0 1 2 3 ] # Final (global) bash arrays are: chrEven_0, chrEven_1, chrEven_2, # chrEven_3, chrOdd_0, chrOdd_1, chrOdd_2 and chrOdd_3. local strng car=Even cmdstr cmdline i cp437 for strng in '44441⣠⣄11⢻⡟11⢨⡅14⢰⡆⢰⡆1⠁⠈144⢀⡀⣀1⢺⡗⣿⠂⢺⡗⣿⠂4⣠⠼⢧⡀⠻⠤⢤⡁⢦⣀⣸⠇1⠘ ⠃14⠛⢀⡴⠃⡴⠋⢠⡄4⢀⡤⣄1⣨⢷⣫⠄⢿⣀⢿⡀41⣶2⠈⠁2441⢀⡤11⣿21⠻⣄141⢤⡀12⣿11⣠⠟144⣐⣦ ⣴⣂⠐⠋⠙⠂44⢀⣰⣆⡀1⠘⠃14441⢰⡆11⠉24⣀⣀⣀⡀44441⢠⡄1441⢀⡴⠃⡴⠋24⢀⡤⣄1⣿⢠⢸⡇⠻⣄⡼ ⠃41⣠⡄1⠈⢹⡇1⢀⣸⣇⡀4⣠⠤⢤⡀1⣠⠞⠁⣾⣁⣠⡄4⣠⠤⢤⡀1⠤⢼⡃⢤⣀⣸⠇41⢀⣤1⣴⣋⣿⡀1⢀⣿⡀4⣤⠤⠤⠄⠿⠤ ⢤⡀⢤⣀⣸⠇4⢀⡤⠄1⣿⠤⢤⡀⢿⣀⣸⠇4⣤⠤⢤⡄1⢀⡼⠃1⣿24⣠⠤⢤⡀⣻⠤⢼⡃⢿⣀⣸⠇4⣠⠤⢤⡀⠻⠤⢼⡇⢀⣀⡼⠃441 ⠘⠃11⠰⠆1441⠘⠃11⣰⠆142⢀⡀⢀⡴⠋11⠙⢦⡀44⠐⠒⠒⠂⠈⠉⠉⠁4⢀⡀21⠙⢦⡀⢀⡴⠋14⣠⠤⢤⡀⠉⢠⡞⠁ 1⢨⡅14⢀⣀⣀1⣿⢠⣼⡇⢿⣘⣛⠁41⣠⡀1⣾⣁⣹⡆⣿1⢸⡇4⢤⡤⢤⡀⢸⡧⢼⡃⣸⣇⣸⠇4⢀⡤⢤⡀⣿2⠁⠻⣄⣠⠆4⢤⡤⣄1 ⢸⡇⢸⡇⣸⣇⡼⠃4⢤⡤⢤⡄⢸⡧⡆⠁⣸⣇⣠⡆4⢤⡤⢤⡄⢸⡧⡆⠁⣸⣇24⢀⡤⢤⡀⣿⢀⣀⡁⠻⣄⡸⡇4⣤1⢠⡄⣿⠤⢼⡇⣿1⢸⡇4 1⢤⡤11⢸⡇11⣸⣇141⠠⣤⠄2⣿1⢿⣀⡿14⢤⡄⢠⡄⢸⣧⡞⠁⣸⡇⢹⡆4⢤⡤2⢸⡇2⣸⣇⣠⡆4⣤⡀⣠⡄⣿⠻⢻⡇⣿1⢸ ⡇4⣤⡀⢠⡄⣿⠻⣾⡇⣿1⢸⡇4⣠⠤⢤⡀⣿1⢸⡇⢿⣀⣸⠇4⢤⡤⢤⡀⢸⡧⠼⠃⣸⣇24⣠⠤⢤⡀⣿1⢸⡇⢿⣰⣼⠇2⠛⠂⢤⡤⢤⡀⢸ ⡧⣼⠃⣸⡇⢸⡇4⣠⠤⢤⡀⠙⠦⣌⠁⢶⣀⣸⠇4⢠⣤⣤⡄⠈⢸⡇⠁1⣸⣇14⣤1⢠⡄⣿1⢸⡇⢿⣀⣸⠇4⣤1⢠⡄⣿1⢸⡇⠙⢦⠞⠁4 ⣤1⢠⡄⣿⢠⢸⡇⢿⡞⣾⠇4⣤1⢠⡄⠘⣷⡟1⣼⠋⢻⡄4⢠⡄⢠⡄⠘⢧⡼⠃1⣸⣇14⣤⠤⢤⡄⠁⣠⠞⠁⣾⣁⣠⡆41⣤⠤11⣿21 ⣿⣀14⡀3⠻⣦⡀11⠈⠻⡆41⠤⣤12⣿11⣀⣿14⣠⠞⢦⡀444444⠒⠒⠒⠒1⠲⣄14444⢐⣒⣦1⢿⣀⢿⡀4⢤⡄ 2⢸⡗⢦⡀⢸⣇⣸⠇44⣴⠒⠲⠄⢿⣀⣠⠄41⠠⣤1⣠⠖⣿1⢿⣀⢿⡀44⣴⣒⣲⡄⢿⣀⣠⠄41⣠⢤⡀⠠⣿⠄⠁⢀⣿⡀144⣴⠒⣴ ⠂⢿⣀⣿1⠲⠤⠟1⢤⡄2⢸⡧⢲⡄⣸⡇⢸⡇41⢠⡄11⢲⡆11⣸⣇142⢠⡄2⢲⡆2⢸⡇⠘⠧⠼⠃⢤⡄2⢸⣇⡴⠂⣸⡏⢳⡄41 ⢤⡄11⢸⡇11⣸⣇144⣶⢦⢶⡄⣿⠸⢸⡇44⢲⡔⢲⡄⢸⡇⢸⡇44⣴⠒⢲⡄⢿⣀⣸⠇44⢲⡔⢲⡄⢸⣇⣸⠇⠼⠧24⣴⠒⣴⠂⢿ ⣀⣿11⠠⠿⠄4⢲⡴⢲⡄⣸⣇244⢴⡒⠲⠄⢤⣉⣳⠄41⣠2⠒⣿⠒11⢿⣠⠄44⣶1⣶1⢿⣀⢿⡀44⣶1⢰⡆⠻⣄⡼⠃44⣶ ⢀⢰⡆⢿⡼⣼⠇44⠲⣄⡴⠂⣠⠟⢧⡀44⣶1⢰⡆⢿⣀⣸⡇⠤⠤⠞⠁4⠶⢒⡶⠂⣴⣋⣠⡄41⢀⡤⠄⠠⢼⡃11⠸⣇⡀41⢠⡄11⢸ ⡇11⢸⡇14⠠⢤⡀11⢘⡧⠄⢀⣸⠇14⠴⠲⠴⠂4444⣠⠞⢦⡀⠿⠤⠼⠇4⢀⡤⢤⡀⣿2⠁⠻⣄⣠⠆⠐⠚⠁1⠤1⠤1⣶1⣶1 ⢿⣀⢿⡀41⣠⠖1⣴⣒⣲⡄⢿⣀⣠⠄4⢀⡴⣄1⢐⣒⣦1⢿⣀⢿⡀4⠤1⠤1⢐⣒⣦1⢿⣀⢿⡀4⠐⢦⡀1⢐⣒⣦1⢿⣀⢿⡀4⠠⣖⡦ 1⢐⣒⣦1⢿⣀⢿⡀44⣴⠒⠲⠄⢿⣀⣠⠄⠐⠚⠁1⢀⡴⣄1⣴⣒⣲⡄⢿⣀⣠⠄4⠤1⠠⠄⣴⣒⣲⡄⢿⣀⣠⠄4⠐⢦⡀1⣴⣒⣲⡄⢿⣀⣠ ⠄4⠠⠄⠠⠄1⢲⡆11⣸⣇14⢀⡴⢦⡀1⢲⡆11⣸⣇14⠐⢦⡀11⢲⡆11⣸⣇14⠒⢀⠐⠂⣴⠋⢳⡄⣿⠉⢹⡇4⠐⢯⠗1⣴⣋ ⣳⡄⣿1⢸⡇4⣀⣐⣋⡀⢸⣇⡌⠃⣸⣇⣡⡆44⠒⣦⢲⡄⢾⡹⣏⡁4⢀⡤⣤⠄⣿⠤⣿⠄⣿1⣿⡀4⢀⡴⣄1⣴⠒⢲⡄⢿⣀⣸⠇4⠤1⠠⠄ ⣴⠒⢲⡄⢿⣀⣸⠇4⠐⢦⡀1⣴⠒⢲⡄⢿⣀⣸⠇4⣠⠶⣄1⣶1⣶1⢿⣀⢿⡀4⠐⢦⡀1⣶1⣶1⢿⣀⢿⡀4⠤1⠠⠄⣶1⢰⡆⢿⣀⣸⡇ ⠠⠤⠞⠁⢒⣀⣐⠂⣿1⢸⡇⢿⣀⣸⠇4⣒1⢐⡂⣿1⢸⡇⢿⣀⣸⠇4⢀⣰⣆1⣿1⠈⠁⠙⢲⡞⠁4⢠⡖⢦1⢺⡗2⣼⣇⣠⠄4⢠⡄⢠⡄⠠ ⢽⡯⠄⠈⢹⡏⠁4⣶⠒⣦1⣿⢉⣵⡀⣿1⢿⡀41⢠⡖⠦⠠⢼⡧⠄⢤⣸⠇14⢀⡴⠂1⢐⣒⣦1⢿⣀⢿⡀41⣠⠖11⢲⡆11⣸⣇14 ⢀⡴⠂1⣴⠒⢲⡄⢿⣀⣸⠇4⢀⡴⠂1⣶1⣶1⢿⣀⢿⡀4⣠⢤⣠⠄⢲⡔⢲⡄⢸⡇⢸⡇4⣚⠙⢚⡁⣿⢷⣼⡇⣿1⢹⡇4⢀⡤⣤1⢈⣓⣛⡂ 44⢀⡤⣄1⢈⣓⣋1441⣤2⢀⡶2⢿⣀⣰⠆44⣤⠤⠤⠄⠿344⠤⠤⢤⡄2⠸⠇4⢴⡆1⡀⠘⣣⠞⠁⠞⠑⣲⠄1⠚⠓⠂⢴⡆1⡀ ⠘⣣⠞⠁⠞⣡⣞⣇2⠘⠃1⢠⡄11⢰⡆11⢿⡿144⣠⢖⡴⠂⠈⠓⠙⠂44⠲⣔⢦⡀⠚⠑⠋14⢐⠨⢐⠨⢐⠨⢐⠨⢐⠨⢐⠨⢐⠨⢐⠨ ⡪⡪⡪⡪⡪⡪⡪⡪⡪⡪⡪⡪⡪⡪⡪⡪⢽⣺⢽⣺⢽⣺⢽⣺⢽⣺⢽⣺⢽⣺⢽⣺1⢸⡇11⢸⡇11⢸⡇11⢸⡇11⢸⡇1⣀⣸⡇11⢸⡇1 1⢸⡇11⢸⡇1⣒⣺⡇11⢸⡇11⢸⡇11⣿⢸⡇⣀⣿⢸⡇1⣿⢸⡇1⣿⢸⡇4⣀⣀⣀⡀1⣿⢸⡇1⣿⢸⡇4⣒⣲⡆11⢸⡇11⢸ ⡇11⣿⢸⡇⣒⣛⢸⡇1⣿⢸⡇1⣿⢸⡇1⣿⢸⡇1⣿⢸⡇1⣿⢸⡇1⣿⢸⡇4⣒⣒⢲⡆1⣿⢸⡇1⣿⢸⡇1⣿⢸⡇⣒⣛⣸⡇441⣿⢸ ⡇⣀⣿⣸⡇441⢸⡇1⣒⣺⡇1444⣀⣀⡀11⢸⡇11⢸⡇11⢸⡇11⢸⣇⣀441⢸⡇1⣀⣸⣇⣀444⣀⣀⣀⣀1⢸⡇11 ⢸⡇11⢸⡇11⢸⣇⣀1⢸⡇11⢸⡇14⣀⣀⣀⣀441⢸⡇1⣀⣸⣇⣀1⢸⡇11⢸⡇11⢸⡇11⢸⣗⣒1⢸⡇11⢸⡇11⣿ ⢸⡇1⣿⢸⣇1⣿⢸⡇1⣿⢸⡇1⣿⢸⡇1⣿⣘⣓4441⣶⢒⣒1⣿⢸⡇1⣿⢸⡇1⣿⢸⡇⣒⣛⣘⣓444⣒⣒⢒⣒1⣿⢸⡇1⣿⢸⡇ 1⣿⢸⡇1⣿⢘⣓1⣿⢸⡇1⣿⢸⡇4⣒⣒⣒⣒441⣿⢸⡇⣒⣛⢘⣓1⣿⢸⡇1⣿⢸⡇1⢸⡇1⣒⣚⣓⣒441⣿⢸⡇⣀⣿⣸⣇444 ⣒⣒⣒⣒1⢸⡇11⢸⡇14⣀⣀⣀⣀1⣿⢸⡇1⣿⢸⡇1⣿⢸⡇1⣿⣸⣇441⢸⡇11⢸⣗⣒4441⢰⣖⣒1⢸⡇11⢸⡇141 ⣀⣀⣀1⣿⢸⡇1⣿⢸⡇1⣿⢸⡇⣀⣿⣸⣇1⣿⢸⡇1⣿⢸⡇1⢸⡇1⣒⣺⣗⣒1⢸⡇11⢸⡇11⢸⡇1⣀⣸⡇14441⢀⣀⣀1⢸ ⡇11⢸⡇1⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿4⣀⣀⣀⣀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿2⣿⣿2⣿⣿2⣿⣿22⣿⣿2⣿⣿2⣿⣿2⣿⣿⣿ ⣿⣿⣿⠿⠿⠿⠿444⣴⢲⡴⠂⢿⣸⢧⡀4⣠⠤⣄1⣿⠠⣟1⣿1⣸⠇4⣤⠤⢤⡄⣿1⠈⠁⣿344⢲⡖⣶⠂⢸⡇⣿14⣤⠤⢤⡄⠈⢳⡄ 1⣴⣋⣠⡄44⣴⢲⡖⠂⢿⣸⠇144⢰⡆⢰⡆⢸⣇⣸⠇⠼⠃24⠚⢹⡞⠁1⢸⡇14⠠⢤⡤⠄⢰⡏⢹⡆⢈⣳⣞⡁4⢀⡤⣄1⣿⠤⢼⡇⠻ ⣄⡼⠃4⢀⡤⣄1⢿⡀⣸⠇⣸⡇⣿⡀41⣠⠤⠄⢀⡬⢷⡄⠸⣇⣸⠇44⣴⢲⡖⣦⠙⠚⠓⠋43⣀⣴⢲⡞⣧⣹⠟⠒⠋41⣠⠤1⢸⡧⠤1⠘ ⢧⣀14⢀⣀⣀1⣿1⢸⡇⣿1⢸⡇44⣉⣉⣉⡁⠤⠤⠤⠄44⠠⢼⡧⠄⢀⣈⣁⡀41⣀21⠈⣳⠄⢀⣚⣁⡀42⣀1⠠⣞⠁1⢀⣈⣓⡀ 41⢀⡤⣄1⢸⡇⠉1⢸⡇11⢸⡇11⢸⡇11⢸⡇1⣶⢸⡇1⠈⠉24⢀⣐⣂⡀1⠐⠂144⠴⠲⠴⠂⠚⠙⠚⠁4⢠⡖⣦11⠉⠁1 4441⢀⡀11⠈⠁1441⢀⡀1442⣶⠒⣀⡀⣿1⠘⢧⣿14⠐⣦⢲⡄1⠿⠸⠇44⠠⠖⣲⠄⠠⠾⠥⠆444⢸⣿⣿⡇⠸⠿⠿⠇ 44444' '44441⢀⣤⡀1⠘⣿⠃2⣭141⣶1⣶1⠈1⠁441⣀⢀⡀⠐⣿⢺⡗⠐⣿⢺⡗4⢀⡤⠿⣄⠘⠧⠤⣌⠰⣄⣀⡿2⠛1 4⠘⠃⣠⠞⢠⠞⠁⣤41⣠⢤⡀⢀⡽⣞⡥⠸⣇⡸⣇41⢰⡆11⠉2442⣠⠄1⢸⡇11⠘⢧⡀41⠠⣄12⢸⡇1⢀⡼⠃44⢀⣲⣤ ⣖1⠚⠉⠓441⣀⣶⣀2⠛14442⣶11⠈⠁14⢀⣀⣀⣀44442⣤1442⣠⠞⢠⠞⠁141⣠⢤⡀⢸⡇⡄⣿⠘⢧⣠⠟41 ⢀⣤11⠉⣿11⣀⣿⣀4⢀⡤⠤⣄1⢀⡴⠋⢰⣏⣀⣤4⢀⡤⠤⣄1⠠⠤⣟⠠⣄⣀⡿42⣠⡄⢠⣞⣹⣇2⣸⣇4⢠⡤⠤⠤⠸⠧⠤⣄⠠⣄⣀ ⡿41⣠⠤1⢸⡧⠤⣄⠸⣇⣀⡿4⢠⡤⠤⣤2⣠⠟1⢸⡇14⢀⡤⠤⣄⢘⡧⠤⣟⠸⣇⣀⡿4⢀⡤⠤⣄⠘⠧⠤⣿1⣀⣠⠟442⠛12⠶1 442⠛11⢀⡶143⣀1⣠⠞⠁1⠈⠳⣄441⠒⠒⠒1⠉⠉⠉41⣀21⠈⠳⣄1⣠⠞⠁4⢀⡤⠤⣄⠈⠁⣴⠋2⣭141⣀⣀⡀⢸ ⡇⣤⣿⠸⣇⣛⡋41⢀⣄1⢰⣏⣈⣷⢸⡇1⣿4⠠⣤⠤⣄1⣿⠤⣟⢀⣿⣀⡿41⣠⠤⣄⢸⡇1⠈⠘⢧⣀⡴4⠠⣤⢤⡀1⣿1⣿⢀⣿⣠⠟4 ⠠⣤⠤⣤1⣿⢴⠈⢀⣿⣀⣴4⠠⣤⠤⣤1⣿⢴⠈⢀⣿⡀141⣠⠤⣄⢸⡇⣀⣈⠘⢧⣀⢿4⢠⡄1⣤⢸⡧⠤⣿⢸⡇1⣿41⠠⣤⠄2⣿11 ⢀⣿⡀42⢤⡤2⢸⡇⠸⣇⣸⠇4⠠⣤1⣤1⣿⣴⠋⢀⣿⠈⣷4⠠⣤⠄11⣿2⢀⣿⣀⣴4⢠⣄⢀⣤⢸⡟⠟⣿⢸⡇1⣿4⢠⣄1⣤⢸⡟⢷ ⣿⢸⡇1⣿4⢀⡤⠤⣄⢸⡇1⣿⠸⣇⣀⡿4⠠⣤⠤⣄1⣿⠤⠟⢀⣿⡀14⢀⡤⠤⣄⢸⡇1⣿⠸⣇⣦⡿2⠘⠓⠠⣤⠤⣄1⣿⢤⡟⢀⣿1⣿4 ⢀⡤⠤⣄⠈⠳⢤⡉⠰⣆⣀⡿41⣤⣤⣤1⠁⣿⠈1⢀⣿⡀4⢠⡄1⣤⢸⡇1⣿⠸⣇⣀⡿4⢠⡄1⣤⢸⡇1⣿⠈⠳⡴⠋4⢠⡄1⣤⢸⡇⡄⣿ ⠸⣷⢳⡿4⢠⡄1⣤1⢻⣾⠃⢠⡟⠙⣧41⣤1⣤1⠻⣤⠟1⢀⣿⡀4⢠⡤⠤⣤⠈⢀⡴⠋⢰⣏⣀⣴41⢠⡤⠄1⢸⡇11⢸⣇⡀4⢀3⠘ ⢷⣄12⠙⢷41⠠⢤⡄2⢸⡇1⢀⣸⡇4⢀⡴⠳⣄444444⠐⠒⠒⠒1⠐⢦⡀44441⣒⣲⡄⠸⣇⡸⣇4⠠⣤21⣿⠲⣄1⣿⣀ ⡿44⢠⡖⠒⠦⠸⣇⣀⡤42⢤⡄⢀⡴⢺⡇⠸⣇⡸⣇44⢠⣖⣒⣦⠸⣇⣀⡤41⢀⡤⣄1⢼⡧⠈1⣸⣇144⢠⡖⢢⡖⠸⣇⣸⡇⠐⠦⠼⠃ ⠠⣤21⣿⠔⣦⢀⣿1⣿42⣤11⠐⣶11⢀⣿⡀43⣤2⠐⣶3⣿1⠻⠤⠟⠠⣤21⣿⣠⠖⢀⣿⠙⣦41⠠⣤12⣿11⢀⣿⡀44 ⢰⡶⡴⣦⢸⡇⠇⣿44⠐⣦⠒⣦1⣿1⣿44⢠⡖⠒⣦⠸⣇⣀⡿44⠐⣦⠒⣦1⣿⣀⡿⠠⠿⠄14⢠⡖⢢⡖⠸⣇⣸⡇2⠼⠧4⠐⣦⠖⣦⢀ ⣿⡀144⠠⣖⠒⠦⠠⣌⣙⡦41⢀⡄1⠐⢺⡗⠂1⠸⣇⡤44⢰⡆⢰⡆⠸⣇⡸⣇44⢰⡆1⣶⠘⢧⣠⠟44⢰⡆⡀⣶⠸⣧⢧⡿44⠐⢦ ⣠⠖⢀⡼⠻⣄44⢰⡆1⣶⠸⣇⣀⣿⠠⠤⠴⠋4⠰⠖⣲⠖⢠⣞⣁⣤42⣠⠤1⠤⣟12⢿⣀42⣤12⣿12⣿141⠤⣄12⣻⠤1⣀ ⡿14⠠⠖⠦⠖4444⢀⡴⠳⣄⠸⠧⠤⠿41⣠⠤⣄⢸⡇1⠈⠘⢧⣀⡴1⠒⠋1⠠⠄⠠⠄⢰⡆⢰⡆⠸⣇⡸⣇41⢀⡴⠂⢠⣖⣒⣦⠸⣇⣀ ⡤41⣠⢦⡀1⣒⣲⡄⠸⣇⡸⣇4⠠⠄⠠⠄1⣒⣲⡄⠸⣇⡸⣇41⠲⣄11⣒⣲⡄⠸⣇⡸⣇41⢴⣲⠄1⣒⣲⡄⠸⣇⡸⣇44⢠⡖⠒⠦⠸ ⣇⣀⡤1⠒⠋11⣠⢦⡀⢠⣖⣒⣦⠸⣇⣀⡤4⠠⠄1⠤⢠⣖⣒⣦⠸⣇⣀⡤41⠲⣄1⢠⣖⣒⣦⠸⣇⣀⡤41⠤1⠤1⠐⣶11⢀⣿⡀41 ⣠⠶⣄1⠐⣶11⢀⣿⡀41⠲⣄11⠐⣶11⢀⣿⡀4⠐⠂⡀⠒⢠⡞⠙⣦⢸⡏⠉⣿41⠺⡽⠂⢠⣞⣙⣦⢸⡇1⣿4⢀⣀⣚⣁1⣿⣠⠙⢀ ⣿⣈⣴44⠐⢲⡔⣦⠰⣏⢿⣉41⣠⢤⡤⢸⡧⢼⡧⢸⡇⢸⣇41⣠⢦⡀⢠⡖⠒⣦⠸⣇⣀⡿4⠠⠄1⠤⢠⡖⠒⣦⠸⣇⣀⡿41⠲⣄1⢠⡖⠒ ⣦⠸⣇⣀⡿4⢀⡴⢦⡀⢰⡆⢰⡆⠸⣇⡸⣇41⠲⣄1⢰⡆⢰⡆⠸⣇⡸⣇4⠠⠄1⠤⢰⡆1⣶⠸⣇⣀⣿1⠤⠴⠋⠐⣂⣀⡒⢸⡇1⣿⠸⣇⣀⡿ 4⢐⡂1⣒⢸⡇1⣿⠸⣇⣀⡿41⣀⣶⡀⢸⡇1⠉⠈⠓⣶⠋41⣴⠲⡄⠐⣿⠂1⢠⣿⣀⡤41⣤1⣤1⠬⣿⠥1⠉⣿⠉4⢰⡖⢲⡄⢸⡏⣩ ⣆⢸⡇⠸⣇42⣴⠲1⠤⣿⠤⠠⣄⡿141⣠⠖11⣒⣲⡄⠸⣇⡸⣇41⢀⡴⠂1⠐⣶11⢀⣿⡀41⣠⠖1⢠⡖⠒⣦⠸⣇⣀⡿41⣠⠖ 1⢰⡆⢰⡆⠸⣇⡸⣇4⢀⡤⣄⡤⠐⣦⠒⣦1⣿1⣿4⢐⡋⠓⣋⢸⡿⣦⣿⢸⡇⠈⣿41⣠⢤⡄1⣙⣚⣓441⣠⢤⡀1⣙⣚⡁441⢠⡄1 1⣰⠆1⠸⣇⣀⡶44⢠⡤⠤⠤⠸⠇244⠠⠤⠤⣤3⠿4⠠⣶1⢀1⢛⡴⠋⠰⠋⢒⡦1⠐⠛⠒⠠⣶1⢀1⢛⡴⠋⠰⢋⣴⣻3⠛2⣤12 ⣶11⠸⣿⠇44⢀⡴⣢⠖1⠙⠊⠓44⠐⢦⡲⣄⠐⠋⠚⠁41⡂⠅⡂1⡂⠅⡂1⡂⠅⡂1⡂⠅⡂⢐⢕⢕⢕⢐⢕⢕⢕⢐⢕⢕⢕⢐⢕⢕⢕⠨ ⣗⡯⣗⠨⣗⡯⣗⠨⣗⡯⣗⠨⣗⡯⣗2⣿12⣿12⣿12⣿12⣿1⢀⣀⣿12⣿12⣿12⣿1⢐⣒⣿12⣿12⣿11⢸⡇⣿⢀⣸⡇ ⣿1⢸⡇⣿1⢸⡇⣿4⢀⣀⣀⣀1⢸⡇⣿1⢸⡇⣿4⢐⣒⣶12⣿12⣿11⢸⡇⣿⢐⣚⡃⣿1⢸⡇⣿1⢸⡇⣿1⢸⡇⣿1⢸⡇⣿1⢸⡇ ⣿1⢸⡇⣿4⢐⣒⡒⣶1⢸⡇⣿1⢸⡇⣿1⢸⡇⣿⢐⣚⣃⣿441⢸⡇⣿⢀⣸⣇⣿442⣿1⢐⣒⣿1444⢀⣀⣀12⣿12⣿12⣿ 12⣿⣀442⣿1⢀⣀⣿⣀444⢀⣀⣀⣀2⣿12⣿12⣿12⣿⣀2⣿12⣿14⢀⣀⣀⣀442⣿1⢀⣀⣿⣀2⣿12⣿12⣿ 12⣿⣒2⣿12⣿11⢸⡇⣿1⢸⡇⣿1⢸⡇⣿1⢸⡇⣿1⢸⡇⣿1⢸⣇⣛4441⢰⡖⣒1⢸⡇⣿1⢸⡇⣿1⢸⡇⣿⢐⣚⣃⣛444 ⢐⣒⡒⣒1⢸⡇⣿1⢸⡇⣿1⢸⡇⣿1⢸⡇⣛1⢸⡇⣿1⢸⡇⣿4⢐⣒⣒⣒441⢸⡇⣿⢐⣚⡃⣛1⢸⡇⣿1⢸⡇⣿2⣿1⢐⣒⣛⣒44 1⢸⡇⣿⢀⣸⣇⣿444⢐⣒⣒⣒2⣿12⣿14⢀⣀⣀⣀1⢸⡇⣿1⢸⡇⣿1⢸⡇⣿1⢸⣇⣿442⣿12⣿⣒4442⣶⣒2⣿12 ⣿141⢀⣀⣀1⢸⡇⣿1⢸⡇⣿1⢸⡇⣿⢀⣸⣇⣿1⢸⡇⣿1⢸⡇⣿2⣿1⢐⣒⣿⣒2⣿12⣿12⣿1⢀⣀⣿14442⣀⣀2⣿1 2⣿1⢸⣿⣿⣿⢸⣿⣿⣿⢸⣿⣿⣿⢸⣿⣿⣿4⢀⣀⣀⣀⢸⣿⣿⣿⢸⣿⣿⣿⢸⣿⡇1⢸⣿⡇1⢸⣿⡇1⢸⣿⡇12⢸⣿2⢸⣿2⢸⣿2⢸⣿ ⢸⣿⣿⣿⠸⠿⠿⠿444⢠⡖⣦⠖⠸⣇⡿⣄4⢀⡤⢤⡀⢸⡇⢼⡃⢸⡇⢀⡿4⢠⡤⠤⣤⢸⡇1⠉⢸⡇244⠐⣶⢲⡖1⣿⢸⡇4⢠⡤⠤⣤1 ⠙⣦1⢠⣞⣁⣤44⢠⡖⣶⠒⠸⣇⡿1441⣶1⣶1⣿⣀⡿⠠⠟24⠐⠋⣷⠋2⣿141⠤⣤⠤1⣾⠉⣷1⣙⣶⣋41⣠⢤⡀⢸⡧⠤⣿ ⠘⢧⣠⠟41⣠⢤⡀⠸⣇⢀⡿⢀⣿⢸⣇41⢀⡤⠤1⣠⠽⣦1⢿⣀⡿44⢠⡖⣶⢲⠈⠓⠛⠚43⢀⢠⡖⣶⢻⢈⡿⠓⠚41⢀⡤⠄1⣿⠤⠄ 1⠻⣄⡀41⣀⣀⡀⢸⡇1⣿⢸⡇1⣿44⢈⣉⣉⣉⠠⠤⠤⠤441⠤⣿⠤1⣀⣉⣀41⢀⡀12⢙⡦1⣐⣋⣀42⢀⡀1⢴⡋11⣀⣙ ⣂42⣠⢤2⣿⠈2⣿12⣿12⣿12⣿1⢰⡆⣿11⠉⠁141⣀⣒⣀2⠒144⠠⠖⠦⠖⠐⠋⠓⠋41⣴⢲⡄1⠈⠉14442⣀ 12⠉1442⣀1442⢰⡖⢀⣀⢸⡇1⠻⣼⡇41⢲⡔⣦1⠸⠇⠿441⠴⢒⡦1⠴⠯⠴4441⣿⣿⣿1⠿⠿⠿44444' ; do strng=${strng//4/1111} strng=${strng//3/111} strng=${strng//2/11} strng=${strng//1/$'\342\240\200'} strng=${strng//[$IFS]} printf -v cmdstr "chr${car}_%d[31]=\"\" " {0..3} printf -v cmdline "chr${car}_%d+=(%%q) " {0..3} printf -v cmdline "$cmdline" ${strng//????/ &} eval "$cmdstr;$cmdline" cp437[160]=255 cp437+=(173 155 156 177 157 188 186 191 169 166 174 170 237 189 187 248 241 253 179 180 230 182 249 184 185 167 175 172 171 190 168 192 193 194 195 142 143 146 128 200 144 202 203 204 205 206 207 208 165 210 211 212 213 153 215 216 217 218 219 154 221 222 225 133 160 131 227 132 134 145 135 138 130 136 137 141 161 140 139 240 164 149 162 147 245 148 246 176 151 163 150 129 178 254 152) printf -v strng 'chr[%d]=${chr[%%d]};' "${!cp437[@]}" printf -v strng "$strng" "${cp437[@]}" for i in {0..3}; do local -n chr=chr${car}_$i eval "$strng" done car=Odd done } buildStrng() { local IFS=$'\n' _str _i _car=${3:-Even} local -n _res=${2:-strArray} _res=() for _i in {0..3}; do local -n _chr=chr${_car}_$_i printf -v _str '${_chr[%d]} ' ${1//?/$'\n'\'&} local -a _arry="(${_str[@]})" printf -v "_res[$_i]" %s "${_arry[@]}" done } declare -i lrefr refresh() { local strng needRefresh=false # (( ${EPOCHREALTIME/.}-lrefr < 300000 )) && return # lrefr=${EPOCHREALTIME/.} COLUMNS=$(tput cols) printf -v strng '%-*s' $(( $COLUMNS / 4 + 2 )) "$displayStrng" buildStrng "$strng" arry1 Odd buildStrng "$strng" arry2 Even rst=${arry1[0]:1} rst=${rst//?/?} printf -v dRhs '%*s' $(( ${#arry1[0]} - COLUMNS )) '' dRhs=${dRhs// /?} secFmt=$(( COLUMNS < 84 ? 20 : COLUMNS < 88 ? 41 : COLUMNS < 92 ? 52 : 63 )) secFmt="%0${secFmt::1}.${secFmt:1}f" printf '\e[K\n\e[K\n\e[K\n\e[K\n\e[K\n\e[K\n\e[K\n\e[K\e[7A\e[K' i=1 } selfLoad() { local _res _arry=($(< /proc/$$/stat)) _ut=($(< /proc/uptime)) _elap printf -v _res '+%d' ${_arry[@]:13:4} _elap=$(( ${_ut[0]/.} - _arry[21] )) _res=00$(( ( _res ) *100000 / _elap )); TZ=UTC printf -v _elap '%dd%(%H:%M)T:%.02f' $(( _elap/8640000 )) \ ${_elap::-2} $(( ${_elap::-2} % 60 )).${_elap: -2} printf -v "$1" 'Run from %s, load: %.2f%%' "$_elap" ${_res::-3}.${_res: -3} } sendToClipboard() { local -a B64=({A..Z} {a..z} {0..9} + /) local strng rhs IFS=' ' IFS= printf -v strng '%d ' ${1//?/\'& }; printf -v strng '%d<<16|%d<<8|%d ' ${strng// 0/ 32} local -ai b6e=($strng) printf -v strng '%s %%s %%%%s %%%%%%%%s ' ${b6e[@]/%/>>18} printf -v strng "$strng" ${b6e[@]/%/>>12\&63} printf -v strng "$strng" ${b6e[@]/%/>>6\&63} printf -v strng "$strng" ${b6e[@]/%/\&63} b6e=($strng) printf -v strng '${B64[%d]}' ${b6e[@]} eval strng="$strng" rhs=${strng/%*(A)};rhs=${strng#$rhs} printf '\E]52;;%s\E\\' ${strng/%$rhs/${rhs//A/=}} } declare -i delay=38111 # nanoseconds exec {altFd}<> <(:) echo Alt: /proc/$$/fd/$altFd printf -v displayStrng 'echo >/proc/%d/fd/%d That\134\47s fun!\n' $$ $altFd sendToClipboard "$displayStrng" displayStrng="${1:-Try: $displayStrng (paste from clipboard)} " buildFont trap 'needRefresh=true' WINCH needRefresh=true pair=(Even Odd) while toSlp=00000$(( delay - ${EPOCHREALTIME/.} % delay )) $needRefresh && refresh printf -v toSlp '%.6f' ${toSlp::-6}.${toSlp: -6} read -rsn 1 -t "$toSlp" userKey [[ ${userKey,} != q ]]; do sec=(${EPOCHREALTIME/./ }) case ${userKey^} in R ) refresh ;; F ) displayStrng="$(fortune | tr \\n \ ) " refresh ;; N ) read -p 'Type your strng: ' -r line && [[ $line ]] && displayStrng="$line " && printf '\e[A' && refresh ;; L ) ( sleep 15;echo "${displayStrng/%*( )}" >&$altFd ) & selfLoad line && displayStrng="$line " refresh ;; esac if read -t 0 -u $altFd _; then read -ru $altFd line && [[ $line ]] && displayStrng="$line " refresh fi printf -v time "%(%d %b %y, %H:%M:)T$secFmt" \ "${sec[0]}" $((sec%60))."${sec[1]}" buildStrng "$time" tarry "${pair[COLUMNS%2]}" printf -v _ '%s%n' "${tarry[0]}" len declare -n arry=arry$i printf '%s\n%s\n%s\n%s\n%*s\n%*s\n%*s\n%*s\e[7A\r' "${arry[@]/%$dRhs}" \ ${tarry[@]/#/$(((COLUMNS-${#tarry[0]})/2+len)) } printf -v tStrng '%%s%s ' "${arry[@]/%$rst}" printf -v tStrng "$tStrng" "${arry[@]/#?}" arry=($tStrng) i=$((3-i)) done