Wrote that a bit earlier
This commit is contained in:
commit
b567611a18
3 changed files with 62 additions and 0 deletions
14
pong.txt
Normal file
14
pong.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
·
|
||||
·
|
||||
·
|
||||
·
|
||||
·
|
||||
·
|
||||
·
|
||||
·
|
||||
·
|
||||
·
|
||||
·
|
||||
·
|
||||
·
|
||||
·
|
44
wait.sh
Executable file
44
wait.sh
Executable file
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
|
||||
fail()
|
||||
{
|
||||
printf "${@}\n" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
FRAMES=()
|
||||
while [ -n "${1}" ]
|
||||
do
|
||||
case "${1}" in
|
||||
-p)
|
||||
PERIOD="${2}"
|
||||
shift 2;;
|
||||
-f)
|
||||
FILE="${2}"
|
||||
IFS="\n"
|
||||
while read LINE
|
||||
do
|
||||
FRAMES+=("${LINE}")
|
||||
done < "${FILE}"
|
||||
shift 2;;
|
||||
*)
|
||||
SEPARATOR="${1:0:1}"
|
||||
INPUT="${1:1}${SEPARATOR}"
|
||||
while [ -n "${INPUT}" ]
|
||||
do
|
||||
FRAMES+=("${INPUT%%${SEPARATOR}*}")
|
||||
INPUT="${INPUT#*${SEPARATOR}}"
|
||||
done
|
||||
shift;;
|
||||
esac
|
||||
done
|
||||
[ -n "${PERIOD}" ] || PERIOD=0.2
|
||||
[ -n "${FRAMES}" ] || fail "Syntax: ${0} [ -p PERIOD ] FRAMES"
|
||||
N=0
|
||||
|
||||
while true
|
||||
do
|
||||
printf "\r${FRAMES[$N]}"
|
||||
N=$(((N + 1) % ${#FRAMES[@]}))
|
||||
sleep $PERIOD
|
||||
done
|
4
wave.txt
Normal file
4
wave.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
-_-¯-_-¯
|
||||
¯-_-¯-_-
|
||||
-¯-_-¯-_
|
||||
_-¯-_-¯-
|
Loading…
Reference in a new issue