Repeat

str_repeat

Repeat a string a given number of times. By default, prints each repetition on its own line. Use -n to suppress intermediate newlines (single trailing newline only).

Arguments

  • $1 (string): Optional: -n to suppress intermediate newlines
  • $2 (string): The string to repeat
  • $3 (int): Optional: number of repetitions (default: 1)

Exit codes

  • 0: Success
  • 1: Unspecified error

Output on stdout

  • The repeated string