From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45280 invoked by alias); 27 Sep 2016 17:18:15 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 45257 invoked by uid 89); 27 Sep 2016 17:18:15 -0000 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 Received: from ishtar.tlinx.org (HELO Ishtar.sc.tlinx.org) (173.164.175.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Sep 2016 17:18:13 +0000 Received: from [192.168.3.12] (Athenae [192.168.3.12]) by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id u8RH6vPX049122 for ; Tue, 27 Sep 2016 10:06:59 -0700 Message-ID: <57EAA9C6.9020900@tlinx.org> Date: Tue, 27 Sep 2016 17:22:00 -0000 From: Linda Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: Use of SHELL env var by login References: <1392107644.20160927141237@yandex.ru> <57EA9CEA.5010204@tlinx.org> <1373245590.20160927194222@yandex.ru> In-Reply-To: <1373245590.20160927194222@yandex.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00359.txt.bz2 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