linux:bash_output_x_chars
Example 1:
# # Function print 50 hyphens # line () { printf -- '-%.0s' {1..50}; printf '\n'; } # # Execute function print 50 hyphens # line
Example 2:
Note: not as good an implementation as example 1, but here you can change what character is being output when calling the function.
#!/bin/bash # # Function print 50 characters # line (){ for i in {1..50}; do echo -n "$1"; done && printf "\n"; } # # Execute function draw 50 hyphens # line '-'
linux/bash_output_x_chars.txt · Last modified: by Allan