Bash : Duplicate a string variable n times [duplicate]
问题 This question already has answers here : How to duplicate string in bash? (4 answers) Closed 5 months ago . I have a variable : str='abc' I would like to copy it n times, with a space between each string, so the echo gives, for n=3 : echo $str abc abc abc I don't want a space after the last abc I've already seen the link mentionned but they doesn't help. The last answer from @Amadan is the good one thanks, but I can't accept it :/ 回答1: One more way: eval echo {1..$n} | sed "s/[[:digit:]]*/$