these commands are equally valid, both commands add „content“ to the end of file – if file does not exists it will be created.
>>file echo "content";
echo $?; # returns the error level (1 = error, 0 = success) of the last run command/application/programm/script
Bash / ksh and other modern shell on Linux has three file descriptors:
Syntax To redirect all error to file
The syntax is as follows to redirect errors (stderr) as follows:
command 2> error_messages_go_here.txt
command > normal_output_goes_here.txt 2> error_messages_go_here.txt
normal_output and error_messages
go into the same file
command > everything.txt 2>&1
output normal_output and error_messages to file and screen
# My script to do blah ...
} 2>&1 | tee script.log