0

Given Bash 5.0.17 and the function

function assign_greeting {
  local -n output_var=$1
  output_var=$(cat)
}

why does echo $GREETING in

$ echo Hello | assign_greeting GREETING
$ echo $GREETING

$

print an empty line instead of Hello? How might I change the function so that GREETING contains the contents of standard input?

0 Answers0