X-Recipient: archive-cygwin@delorie.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:date:from:reply-to:message-id:to:subject
	:in-reply-to:references:mime-version:content-type
	:content-transfer-encoding; q=dns; s=default; b=uqrta22ODjYhDF5t
	CS36A1auhYXBKqJUUkkg9HZTX32CsXnh+t0qXEiXIjcbd3JitPTDAVPEF0Ely+4t
	+lLQKOnxk5AW/6hnbRqomlnxr1aF+zoM7JptlDquxdjec4sygyBvbPf77PRNM2bf
	bQEeLekZhGnk/mAwITREDn6Iavw=
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:date:from:reply-to:message-id:to:subject
	:in-reply-to:references:mime-version:content-type
	:content-transfer-encoding; s=default; bh=fnW3LuGNrXQ42SdFPWXoix
	/zI3Y=; b=FSlTsjIgoe3kjHqGZneA6hPnOnm7zXE0gQqBXr8Bu6W6YTnOgNUgms
	TjlLKZajStRBVsw1OHBIrHKs0yDrtUG1JWOBgtyWQyyiKr07TCyKt4a581bfb0+K
	+jluCK4mU6tracIF9EzaS8Qd7BAsHlD/tKZ/QoS4mFWB/yI47Nk2g=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=2.0 required=5.0 tests=BAYES_50,FREEMAIL_FROM,KAM_THEBAT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=H*F:D*yandex.ru, yandexru, UD:yandex.ru, yandex.ru
X-HELO: forward3h.cmail.yandex.net
Authentication-Results: smtp2j.mail.yandex.net; dkim=pass header.i=@yandex.ru
X-Yandex-Suid-Status: 1 0,1 0
Date: Sat, 27 Aug 2016 19:10:30 +0300
From: Andrey Repin <anrdaemon@yandex.ru>
Reply-To: cygwin@cygwin.com
Message-ID: <1545876997.20160827191030@yandex.ru>
To: Christian Franke <Christian.Franke@t-online.de>, cygwin@cygwin.com
Subject: Re: Proposal for new cygwin.bat which is independent from install directory
In-Reply-To: <57C1788B.2010705@t-online.de>
References: <57C06CFA.4060405@t-online.de> <1974732522.20160826193931@yandex.ru>   <daq2sb15dt33v54ekoc1p8f4snvepa0og0@4ax.com> <57C1788B.2010705@t-online.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

Greetings, Christian Franke!

>> Also don't see why so complicated. While staying in the console, how
>> about:
>> -----
>> @echo off
>>
>> cd /d "%~dp0\bin"
>>
>> bash --login -i
>> -----

> An errorlevel check is IMO mandatory after a cd command.

Absolutely unnecessary.
--login will change the CWD either way, and if it fail to execute, it will
fail either way.
Do NOT include redundant error handling "just because you can", or to report
to the user.
Only include error handling, if you have a plan to recover from error
condition, otherwise the scripting engine will report the error on its own,
you don't need to do anything special for that.

> Otherwise
> another bash in the PATH might be started if the directory does not exist.

That's because you're doing it wrong.

> Hmm... therefore it is also better to change the last line to:

>    .\bash --login -i

"%~dp0bin\bash.exe" --login -i

> The directory change is intentionally done with two cd commands to avoid 
> possible problems with cmd variants (on Win10 "%~dp0" expands to a path 
> with trailing backslash).

It ALWAYS expands into a path with trailing slash.
Read CALL /? and note the combining rules for modifiers.


-- 
With best regards,
Andrey Repin
Saturday, August 27, 2016 19:05:19

Sorry for my terrible english...


--
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

