Here are two ways on who to redirect both standard output and standard error to same file in bash. First the official a recommended way:

printf '%s\n%\n' "Hello bash" > FILE 2>&1

now easier unofficial way:

printf '%s\n%\n' "Hello bash" &> FILE


Free Linux eBooks

Go to top