Ed_P wrote:And I thought this was the solution.
Depends on what solution is being sought. Seem to be at cross purposes here. Thought there was a requirement to put something into your script to detect files with windoze line ends, so that then this could help find out how it happened. Then of course the solution mentioned above would be applied. Made illustration of this in finding '\n', so that could see would work in same way to find '\r'. Made also as documentation for future reference.
Ed_P wrote:If you have made a change to safm.sh please post the source.
Really don't need to risk all this extra hassle when there are perfectly good system utilities available which will do the job. Just have to do a little extra work after compressing the script: getting md5sums of .sh an .xz files, encode the binary, copy the output and paste into code block of post, then copy this code block and paste as input for decoding to binary, get md5sum and check with that of source binary, and finally decompressing and comparing check sums, which were then posted.
So, to get back exactly the same text file, is just a three step operation, taking five minutes at most. If this is too much, then I shall post the source file when satisfied it is working correctly in all aspects of operation.
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB