Reputation: 23
I'm learning the basics on bash scripting, and basically what I'm trying to do is have an output of "..." with a pause in between each period.
I've tried echo . ; sleep 1 ;echo . ; sleep 1 ; echo . ; sleep 1
and other ways but the output is always vertically, line by line. I'm aware of what ";" and "&&" does but I'm just learning, and the only way that seemed close was a "echo . `sleep 1 command...
Is echo or sleep even the right command for this?
Sorry for being so dim-witted but I just can't figure this out!
Upvotes: 2
Views: 2367
Reputation: 8412
if your are looking to echo ...
echo "..." ; sleep 1 ;echo "..." ; sleep 1 ; echo "..." ; sleep 1
echo as the name implies is to "output" and yes "sleep" is definitely the command you need to for pausing.
if you want to use echo and output ...
on the same line three times. you can use
echo -n "..." ; sleep 1 ;echo -n "..." ; sleep 1 ; echo -n "..." ; sleep 1
Upvotes: 2
Reputation: 531065
echo
automatically prints a newline after its arguments. To suppress it, you might be able to use the -n
option, but that isn't universally supported. Instead, use printf
.
printf '.'; sleep 1; printf '.'; sleep 1; printf '.'; sleep 1
Upvotes: 1