res=`echo "hello" > /home/directory/folder1/xxx.txt 2>&1`
/home/directory/folder1/xxx.txt: Permission denied
echo $res
EMPTY LINE
i expect the error to be stored in the variable res , why it is not getting stored and what to do for having error stored in the variable ?