bash prinf goes to log but output= not The first line of this snipet goes to the logfile, but the second doesn't.
I need the second be executed and loged. 

#!/bin/bash
printf '%s %s (%s) running...\n' 2&gt;&amp;1 | tee -a $logfile
output=$(restic -r ${backupdir} snapshots ) 2&gt;&amp;1 | tee -a $logfile


How can i log the output= line as well?
In the second line, there should be no output! You're assigning the result of restic -r ${backupdir} snapshots to output, and that won't produce any output, either to stdout or to stderr (it's equivalent to output="Value stored for later" - when this command executes, there's no output).

Try something like...

output=$(restic -r ${backupdir} snapshots )
echo $output | tee -a $logfile


Or you could simplify it by just doing...

restic -r ${backupdir} snapshots 2&gt;&amp;1 | tee -a $logfile