Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 2
    For those that want the simplest stuff I just made mine with cprn first answer. It's a very simple progress bar in a function that use some stupid proportionality rule to draw the bar: pastebin.com/9imhRLYX Commented Apr 20, 2020 at 14:05
  • 1
    It's correct if you use bash and not sh, otherwise some people can have a Bad substitution on ${BAR:0:$i}. Commented Nov 22, 2021 at 10:54
  • You might be right. Nowadays sh in many distributions is linked to bash or a script that runs bash --posix compatibility mode and I suspect it was so on my system in 2016 when I wrote and tested this answer. If it doesn't work for you you can replace ${name:n:l} with $(expr "x$name" : "x.\{0,$n\}\(.\{0,$l\}\)") which is proven to work in any POSIX shell (originated in ksh93 and is also present in zsh, mksh and busyboxsh). I'm leaving the original answer, though, for readability and because it should just work in the vast majority of cases. Commented Nov 22, 2021 at 14:12