samedi 3 septembre 2016

Stepping through a random string character by character?

Working on this: A simple game to echo a random keyboard character; then have the user match that character as fast as possible (this is not implemented yet (obviously) but that's the goal) and keep a running total of the "correct matches." #!/bin/bash score=0 while true; do clear echo "$score" character=$(

Directly, my question is: Why am I getting

[: missing `]'

error. I have tried all variants of

if [ "$character" = "$input" ]; then

and second question: How would I properly ask my next question which is: given a long random string, how would one "explode" that string such that it has a space in between every character? I do not have the experience/lexicon to describe this operation.

Much appreciated!




Aucun commentaire:

Enregistrer un commentaire