I have a variable (extracted from a diff file result) with leading spaces that I want to insert into a file at a specific line. The variable:
add="     public function add($hardware_id = null)"
But when I insert the line with sed, it doesn't print the leading spaces:
$ sed "50i$add" file
...
public function add($hardware_id = null)
...
How to preserve the leading spaces?

