Linux command to repeat a string n times - Super User

2010-07-20 1 min read bash Linux

I was working on something and needed to output the string n times. I have required this even to print a line with ’-’ or ’=’ but this time I badly wanted it in bash. So I searched google and found this:

printf ”Amit Agarwal%.0s” {1..5}

Explanations and other examples: <a href=""><h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="">1 reviews of Flat-Rate US Terminations ( <li class="zemanta-article-ul-li"><a href="">Top Linux GUI ( <li class="zemanta-article-ul-li"><a href="">A guided tour of Emacs ( <div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href=""><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="" alt="Enhanced by Zemanta" /><span class="zem-script more-related pretty-attribution">

comments powered by Disqus