2 ms·
Note that dos2unix and unix2dos do what you expect when used as filters, but overwrite the specified file in place when given a file name. This is a footgun sec
by mananaysiempre 5y ago
Note that dos2unix and unix2dos do what you expect when used as filters, but overwrite the specified file in place when given a file name. This is a footgun second only to one in pdftotext, arguably, which (unsurprisingly) refuses to work as a filter and (surprisingly) will silently create a matching .txt file when passed a single .pdf as an argument.
- spc476 5y agoWhy is that a footgun? If it just piped the output to stdout, then to convert a file, you then have to $ dos2unix file >x $ mv x file In my mind, overwriting the file is the Right Thing.
- romwell 5y agoThe Right Thing would be to require an explicit -o <output filename> option to avoid modifying files without getting user's consent first. Especially because the changes it makes are irreversible (e. g. when a text file has mixed unix/dos line endings).