bash combine strings code example
Example 1: bash combine output from two commands
# Basic syntax:
{ command_1 ; command_2 ; ... } > output_file
# Where the standard outputs of command_1, command_2, and any others
# used will be printed (in order of the commands) to the output_file
# Note, adding a space between the commands and the braces {} and
# semicolons ; can help avoid syntax issues with the commands
Example 2: combine strings bash
foo="Hello"
foo="${foo} World"
echo "${foo}"
> Hello World
Example 3: concatenate strings bash
VAR1="Hello,"
VAR2=" World"
VAR3="$VAR1$VAR2"
echo "$VAR3"