I'm writing a shell (sh) script to be run on a BusyBox terminal. The script redirects a system command output to a file for logging purposes using the >> operator. How do I determine the end of line (EOL) character(s) being used, so that the script can accurately calculate the anticipated file size? Anticipated file size is important in my application because there are strict disk usage requirements.
(I'm aware that I could just look at the file in a binary editor and see exactly what's it's using for line ends, but my script needs to be portable. So, either I need to be reasonably confident that the EOL character(s) won't change--e.g. OS defined--or I need to be able to capture and count.)