Skip to content

Latest commit

 

History

History
48 lines (28 loc) · 1.01 KB

repeat-string.md

File metadata and controls

48 lines (28 loc) · 1.01 KB

src/repeat-string.bash

Repeat a string N times.

Overview

repeat-string outputs given string repeated N times.

Index

repeat-string

Repeat a string N times.

Example

source "${BASH_SOURCE[0]%/*}/libs/biapy-bashlings/src/repeat-string.bash"
repeat-string 40 '-*'

Arguments

  • $1 (integer): The number of times the given string should be repeated.
  • $2 (string): A string to be repeated.

Exit codes

  • 0: If the string is repeated successfully.
  • 1: If an argument is missing or more than two arguments given.
  • 2: If first argument is not a integer.

Output on stdout

  • The $2 string repeated $1 times.

Output on stderr

  • Error if an argument is missing or more than two arguments given.
  • Error if first argument is not a integer.

See also