Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>How about this?</p> <pre><code># The characters you want to use chars=( $'\xe2\x95\xb1' $'\xe2\x95\xb2' ) # Precompute the size of the array chars nchars=${#chars[@]} # clear screen clear # The loop that prints it: while :; do printf -- "${chars[RANDOM%nchars]}" done </code></pre> <p>As a one-liner with shorter variable names to make it more concise:</p> <pre><code>c=($'\xe2\x95\xb1' $'\xe2\x95\xb2'); n=${#c[@]}; clear; while :; do printf -- "${c[RANDOM%n]}"; done </code></pre> <p>You can get rid of the loop if you know in advance how many characters to print (here 80*24=1920)</p> <pre><code>c=($'\xe2\x95\xb1' $'\xe2\x95\xb2'); n=${#c[@]}; clear; printf "%s" "${c[RANDOM%n]"{1..1920}"}" </code></pre> <p>Or, if you want to include the characters directly instead of their code:</p> <pre><code>c=(╱‬ ╲); n=${#c[@]}; clear; while :; do printf "${c[RANDOM%n]}"; done </code></pre> <p>Finally, with the size of the array <code>c</code> precomputed and removing unnecessary spaces and quotes (and I can't get shorter than this):</p> <pre><code>c=(╱‬ ╲);clear;while :;do printf ${c[RANDOM%2]};done </code></pre> <p>Number of bytes used for this line:</p> <pre><code>$ wc -c &lt;&lt;&lt; 'c=(╱‬ ╲);clear;while :;do printf ${c[RANDOM%2]};done' 59 </code></pre> <p><strong>Edit.</strong> A funny way using the command <code>yes</code>:</p> <pre><code>clear;yes 'c=(╱ ╲);printf ${c[RANDOM%2]}'|bash </code></pre> <p>It uses 50 bytes:</p> <pre><code>$ wc -c &lt;&lt;&lt; "clear;yes 'c=(╱ ╲);printf \${c[RANDOM%2]}'|bash" 51 </code></pre> <p>or 46 characters:</p> <pre><code>$ wc -m &lt;&lt;&lt; "clear;yes 'c=(╱ ╲);printf \${c[RANDOM%2]}'|bash" 47 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload