Hello.
I'm creating a script in Bash, and i would like to add a little feature but i don't know how.
I want the "echo" command to print a line one character at the time, instead of instantly printing the full line in a single shot.
Anyone knows how to do this?
Pic related more or less.
>>253888
>Doing this isn't what bash is for.
If you can do it, why you shouldnt? It's not like there is a law or something aganist it.
ALSO, pacman itself uses this feature in the progress bar during download and installing of packets, so it's not like "i'm doing something new"
One Question:
This way, if i want to do something progressive for a line of text, i have to put every single line
>>253928
And you could write it in Befunge or InterCAL too.
After all, Turing-complete is Turing-complete!
As to your question, you could probably use a loop with some bash string-slicing and bash arithmetic.
>>253936
Well, thanks for your help m8, i've found also that putting /r at the end makes it perfectly suitable for my purpose.
Now i'm working on the loop, i think i'll create a function that will be called instead of echo
item="string goes here."
for i in $(seq 0 ${#item})
do
echo -n "${item:$i:1}"
sleep 0.05
done
echo