I gotta make this BASH script reminiscent of Spritz. It's basically a speed reading program, pic very related. I don't want to do it from scratch. If anyone has ever done a similar assignment, I'd appreciate a copy of that. It doesn't have to be exact, and I'm going to make a bunch of changes too it regardless so I can figure out how it works. Thanks in advance.
>>231880
I'm trying really hard, and I'm struggling to think of a language less appropriate for this task than bash.
Maybe befunge, but even befunge is at least designed to be interactive.
>>231889
Tell me about it, but that's the task.
I got a look at the proff's code and despite it working it looks convoluted as fuck.
>>231880
Also
>speed reading
Most people just call that "reading". If you can't read faster than you can talk, then you have a learning difficulty you need to overcome, because most people can read without needing to vocalise.
>>231892
Hey that's what they call this style of program in the assignment instructions, I didn't think it up.
>>231890
Are you allowed to call out to AWK, or are you going to have to tokenise the lines yourself?
At least the core loop is pretty straightforward:
echo \r
echo $A_BUNCH_OF_SPACES
echo \r
echo $ONE_WORD
sleep $CALCULATED_DELAY
>>231890
For tokenising, see http://stackoverflow.com/a/10586169
Other than that, it's just glue code.
>>231890
And I guess you already know this, but here's how to do arithmetic in bash: https://bash.cyberciti.biz/guide/Perform_arithmetic_operations
I'd work in integer numbers of microseconds, because bash sucks at floating point.
Some nice links, I'm allowed to use AWK, but I'll look into the tokenising.
Thanks.
>>231903
AWK can call sleep, so technically you could do it in AWK.
But if AWK is on the cards, then I'd probably do it like this:
- use mktemp to get a unique temporary file
- use awk to write the temp file with one word per line
- while read temp file do core loop
Alright I'll work on that.
Thanks for your help!