My script is supposed to take input from a pipe and replace newline characters with commas, using the bash's string substitution:
#! /bin/bash
read -d -r input 
echo $input 
$input=${input//\n/,}
echo $input
However, instead of replacing the newline character, bash tries to execute the first matching pattern:
echo -e "this\nis\na\ntest\n" | test.sh 
will give the following output:
test.sh: line 5: this: command not found 
and the variable $input is not changed. Double or single quotes did not help either. I'm using bash version 4.3.11 on Linux Mint. 
