No, this doesn't work the way you think it does:
makeFLB=$(echo $FLBheading > /etc/addons/$FLBfile)
"variable=$( command )
" sets the value of variable
to the standard out
. But "command > filename
" redirects the stdout of command
, and so there's no output available to set the variable with.
variable will always come out empty.
So to start with, do the redirection on its own, without the variable setting:
echo "$FLBheading" > "/etc/addons/$FLBfile"
Then tell us what the makeFLB
variable is supposed to contain, so we can help you set it properly.
(P.S.: You also don't need to touch
the filename first. >
will create the file if necessary.)
Next, for the record, your first error message resulted from here:
makeFLB=$(/etc/addons/$FLBfile << $FLBheading)
The section inside $()
is considered a separate command
environment, but here there's no executable command name inside it; only a filename. Since file redirections like "<<
" only work in the context of executed commands, in this case it's instead treated as the beginning of a here document
And since there's no matching closing string for the heredoc in the script, it chokes and coughs up the error given.