SHOW:
|
|
- or go back to the newest paste.
1 | #!/bin/bash | |
2 | # Count to one million script (for forum games) | |
3 | # This script requires a program called 'xsel' to | |
4 | # copy the text to the X clipboard. | |
5 | ||
6 | # This script is contributed to the public domain with CC0. | |
7 | # See https://creativecommons.org/publicdomain/zero/1.0/legalcode for more info. | |
8 | ||
9 | # Checks if command line options are missing. | |
10 | if [[ $1 = "" ]]; then | |
11 | echo "Usage: `basename $0` [NUMBER]..." | |
12 | exit 1; | |
13 | fi | |
14 | ||
15 | let "NUMBER = $1" | |
16 | QUITHANDLER=0 | |
17 | END=1 | |
18 | ||
19 | while [[ $QUITHANDLER -lt $END ]] | |
20 | do | |
21 | let "REMAINING = 1000000 - $NUMBER" | |
22 | echo "$NUMBER | |
23 | ||
24 | (Only $REMAINING to go!)" | xsel -b -i | |
25 | ||
26 | echo "Copied to clipboard ($NUMBER) Press enter to repeat. | |
27 | Type any number greater than 0 to quit." | |
28 | ||
29 | read QUITHANDLER | |
30 | let "NUMBER++" | |
31 | done |