Posts Tagged - bash

Increase readability of your bash scripts using functions

You can find it very obvious, but there are tons of bash scripts out there written very badly.

People often forget that Bash actually a programming language. And just like JavaScript, Python, Ruby, GoLang and many others languages, Bash language has functions.

Let’s check simple bash function which prints green string taken as an argument:

logger() {
  local GREEN="\033[1;32m"
  local NC="\033[00m"

  echo -e "${GREEN}Logger: $1 ${NC}"
}

Read More