wikiti
4/27/2017 - 12:40 PM

Bash functions

Bash functions

# Define a function
function example {
  echo $1 $2
}

# Call it
example "Hello!" "World!"

# Capture stdoutput
variable=$(example "Hello!" "Variable!")

# Check return value
echo $?