linux - How to duplicate string in bash? -
i have following string in bash
str="kallel" i want create str str2. str2 contains str duplicated till length = 20. result should this:
str2="kallelkallelkallelka" how in in bash?
this should work:
str="kallel" str2="${str}" while (( ${#str2} < 20 )) str2="${str2}${str}" done str2="${str2:0:20}"
Comments
Post a Comment