Linux Shell - AlphaZuluLima/PersonalWiki GitHub Wiki

13 resources for learning to write better Bash code

https://www.redhat.com/sysadmin/learn-bash-scripting

How to repeat a character ā€˜n’ times in Bash

https://www.cyberciti.biz/faq/repeat-a-character-in-bash-script-under-linux-unix/

printf -- '-%.0s' {1..80}; printf '\n'

printf '~%.0s' {1..80}; printf '\n'

seq -s- 80 | tr -d '[:digit:]'

Case statement

https://linuxize.com/post/bash-case-statement/

'cat' equivalents

while read line; do echo $line; done < /etc/passwd

Lines of text file to shell array

unset myarray ; mapfile myarray < /etc/passwd ; for line in "${myarray[@]}" ; do echo $line ; done

unset myarray ; readarray myarray < /etc/passwd ; for line in "${myarray[@]}" ; do echo $line ; done