Web lists-archives.com

portable use of dos2unix WAS: Re: textmode for stdout, what is "correct" now?




Hi Andrey,

On 2/15/19 1:45 PM, Andrey Repin wrote:
> Greetings, Michael Haubenwallner!
> 
>>>
>>> For scripting, d2u should help.
> 
>> Plus, to be portable: type d2u >/dev/null 2>&1 || d2u() { cat; }
> 
> _d2u="$( which d2u 2> /dev/null || echo cat )"

To be honest, this is less portable for some reasons:

* "$(...)" is not Bourne Shell (/bin/sh) but POSIX Shell (ksh, bash, ...)
* "which" is C Shell and has it's own troubles (may load ~/.cshrc first)

On 2/15/19 1:48 PM, Corinna Vinschen wrote:
> 
> For portability, use `dos2unix'.  It's packed with most (all?) Linux
> distros.

Well... available yes, but not installed by default (any more).

> 
> if you want to be THAT nice.
> 
>> So, firsthand I do prefer to avoid that need.
> 
> +1

/haubi/

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple