[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Hello. I'm creating a script in Bash, and i would like to

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 7
Thread images: 1

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.
>>
>>253870
>>253870
echo -n
sleep
echo -n
sleep
echo -n
sleep

This is really stupid though. Doing this isn't what bash is for. It's lime writing a game in excel, or using quakeC to manage your files.
>>
>>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
>>
>>253870
>>253938
I tried it.
Whitespaces didn't work.

@echo off
setlocal enableDelayedExpansion
@echo off
set "var=I'm, a text"
set len=20

FOR /L %%A IN (0,1,%len%) DO (
set varr= !var:~%%A,1!
echo|set /p=!varr!
)

Good luck anon!
>>
item="string goes here."

for i in $(seq 0 ${#item})
do
echo -n "${item:$i:1}"
sleep 0.05
done
echo
Thread posts: 7
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.