diff --git a/guide/crime5/typewrite.sh b/guide/crime5/typewrite.sh index 7e8eaf8..f62f256 100644 --- a/guide/crime5/typewrite.sh +++ b/guide/crime5/typewrite.sh @@ -3,12 +3,13 @@ type_text() { local text="$1" local delay="$2" - local i + local i char - for ((i=0; i<${#text}; i++)); do - printf "%c" "${text:$i:1}" + while IFS= read -r -n1 char; do + printf "%b" "$char" sleep "$delay" - done + done <<< "$text" + printf "\n" }