delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/02/15/13:25:25

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:references:from:to:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=hzP8M9lSvq7sKYPl
Vdm0AHWq+qSVNGzdMLCv7t6so1skKjFIhXZFMIuCOFW7m6VtureLEAatgkFrwBD/
8RBLjJojRcg6OhCbD1pErKFs1VxiImG1g9DAGEZpEDhrOIejB1d0jO0sTQ7PQgFp
o+KMqmoUue+ULYrujROZ876UvLw=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:references:from:to:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=HJ17njPKTH0JdXVdj6AmSV
eRYdI=; b=X+KIpLnrtuw2ZbzdAn9R7JRKCFrXCRBJw5v2xqYxa43dvdqs0m1TTv
Pf80TQfU3f3/weXd4hvQzCQ0ttqMTOH1De9EO/Q5oJnW10v5Eet79mNCjqxOgZOa
1VZCaOcwgICyJCesCHLEct/tOUzeIrXPHUacpNVZnDdNY81XSm+zc=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=
X-HELO: atfriesa01.ssi-schaefer.com
Subject: portable use of dos2unix WAS: Re: textmode for stdout, what is "correct" now?
References: <739ed5ce-6902-d702-e152-65dc2c1da667 AT ssi-schaefer DOT com> <20190214162002 DOT GA4950 AT calimero DOT vinschen DOT de> <6aa280c2-4769-0772-91d9-c73a3a3d9680 AT ssi-schaefer DOT com> <20190215102251 DOT GA2702 AT calimero DOT vinschen DOT de> <f7345109-5b22-a342-df1e-940e236c2397 AT ssi-schaefer DOT com> <1282767785 DOT 20190215154502 AT yandex DOT ru>
From: Michael Haubenwallner <michael DOT haubenwallner AT ssi-schaefer DOT com>
To: cygwin AT cygwin DOT com, Andrey Repin <anrdaemon AT yandex DOT ru>
Message-ID: <d59689ee-4bf3-d66f-ca0b-f9cec8dda035@ssi-schaefer.com>
Date: Fri, 15 Feb 2019 19:24:57 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0
MIME-Version: 1.0
In-Reply-To: <1282767785.20190215154502@yandex.ru>

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019