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:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; q=dns; s=default; b=KGTs5r5f2t3SJG2kxliZqMBf9EJC9dJ1q5CftdjQblI Pyk7UUy+gJAxF7Mjr8WNTfp78fVewEtBgKrDge6P2GJaGzjLPSpRdcfZXSDdAadn Z4OSMxavjxqs2YHa66qPyTg3NC1PmqcuSoh2Cfr09vqkII4sWP3Huomoy03OFVtM = 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:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; s=default; bh=RCevv+3G2QoOI3C7ftovV9IaU8k=; b=Xad26blsG7aF9+keL idaP37AAAHY2YpccUGUj2AbeeyBFaOoVSNCqWITnBQmYfTEYqT26Q4o0MeqiH5uR q+uLZUmjVwmYY5dUcn4dfiOEmplREtuEnK0LAfkc2hmH6Tdc2IS0d+0injhVJAOH 8YX33oAabFPblqNB9PSRh2A/FI= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Destination, H*i:sk:1373245, H*MI:sk:1373245, H*f:sk:1373245 X-HELO: Ishtar.sc.tlinx.org Message-ID: <57EAA9C6.9020900@tlinx.org> Date: Tue, 27 Sep 2016 10:17:58 -0700 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Use of SHELL env var by login References: <1392107644 DOT 20160927141237 AT yandex DOT ru> <57EA9CEA DOT 5010204 AT tlinx DOT org> <1373245590 DOT 20160927194222 AT yandex DOT ru> In-Reply-To: <1373245590.20160927194222@yandex.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Andrey Repin wrote: > Greetings, Linda Walsh! >> Windows *doesn't* use "SHELL" to set your command line, it uses >> COMSPEC. > > Do note I didn't mention any specific variable names. --- Indeed -- wanted to be explicit for those not know that the space in-between the lines is important! ;-) > And I've explicitly outlined exactly the case you are describing in your post > - integration. > If you indeed have "more other" applications (native ports of certain tools, > which still use environment as a go-to reference sources), then by all means, > do what you find best for you. > I do that all the time, too, but I also have Cygwin itself configured to match > the environment I expect to have. Just to avoid issues. --- Yup -- I use the same site-wide login scripts (for me & root and multi-machine) on linux and cygwin and regularly make sure to copy and test them on both -- not to mean I don't have cygwin specific sections that key off OS: if ! type -f cygwin 2>/dev/null ; then read SYSTEM_KERNEL HOSTNAME OSTYPE <<<"$($_prg_uname -sno)" if [[ $OSTYPE =~ Cygwin ]]; then sub cygwin () { return 0; } else sub cygwin () { return 1; } fi export -f cygwin fi # and some cygwin-only defs in /etc/local/cygwin, like alias gvim='setsid gvim' # ensure win-native vim backgrounds properly and a version of "mklink" that runs in bash and uses the *nix syntax of "mklink " (and auto-handles directories) -------------------------------------------- #!/bin/bash #set -x shopt -s expand_aliases extglob sourcepath ## ## func to help determine if we were called as script or lib & ## not dirty env if called as lib ## function conditional_setprog { local lprogpath="$0" [[ $lprogpath =~ .*bash.* ]] && { lprogpath="$1"; shift; } local lprog="${lprogpath##*/}" lprogdir="${lprogpath%/*}" local lprogname="${lprog%.*}" if [[ $lprogname =~ errnos ]]; then declare -g prog="$lprog" progpath="$lprogpath" progname="$lprogname" fi } conditional_setprog "$@" #include stdalias #include errnos # -- include needed bits for fewer includes alias intConst=declare\ -ir sub=function my=declare int=declare\ -i intConst ENOENT=2 EEXIST=17 ENOSYS=38 ENOMSG=42 sub mklink () { sub err_ex { my err="${!1}" msg="$2" echo "$msg" >&2 return $err } if (($#!=2)) && [[ ! $0 =~ bash ]] ; then echo "mklink # (destination must not exist)" >&2 fi local src=${1%/.} dst=${2%/.}; src=${src%/} [[ $dst == . ]] && dst="${src##*/}" [[ -e $dst ]] && { err_ex EEXIST "Destination, \"$dst\", already exists." return } [[ -e $src ]] || { err_ex ENOENT "Source, \"$src\", does not exist." return } local dest_type="unknown" if [[ -f $src ]]; then dest_type="" elif [[ -d $src ]]; then dest_type="/d" else err_ex ENOSYS "Cannot determine src, \"$src\" as file or dir" return fi local winsrc windst printf -v winsrc "%s" "$(cygpath -wl "$src")" printf -v windst "%s" "$(cygpath -wl "$dst")" # windows reverses everything *nix # just to be different from CP/M which modeled Unix printf -v cmd 'cmd /c mklink %s "%q" "%q"' "$dest_type" "$windst" "$winsrc" eval "$cmd" (($?)) && err_ex ENOMSG "Windows return unexpected status($status)" } export -f mklink (($#==0)) || [[ $0 =~ bash ]] || mklink "$@" # vim: ts=2 sw=2 -------------------------- -linda -- 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