www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/08/24/07:40:46

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <4E51537C.3080506@cwilson.fastmail.fm>
References: <4E51537C DOT 3080506 AT cwilson DOT fastmail DOT fm>
Date: Wed, 24 Aug 2011 13:40:20 +0200
Message-ID: <CAMfsiJE0MadfCZWKkdbmvtSDU_pq1c+Vrx6iCv3pRaNsGGBAKQ@mail.gmail.com>
Subject: Re: dash incompatibility in /etc/profile
From: David Sastre <d DOT sastre DOT medina AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

2011/8/21, Charles Wilson wrote:
> Running 'dash -l' flags an error in /etc/profile:
>
> if [[ -n ${BASH_VERSION} ]]; then
>   HOSTNAME=$(/usr/bin/hostname)
>   profile_d sh
>   [[ -f "/etc/bash.bashrc" ]] && . "/etc/bash.bashrc"
> elif [[ -n ${KSH_VERSION} ]]; then
>   typeset -l HOSTNAME=$(/usr/bin/hostname)
>   profile_d sh
>   PS1=$(print
> '\033]0;${PWD}\n\033[32m${USER}@${HOSTNAME}\033[33m${PWD/${HOME}/}\033[0m\n$
> ')
> elif [[ -n ${ZSH_VERSION} ]]; then
>   HOSTNAME=$(/usr/bin/hostname)
>   profile_d zsh
>   PS1='(%n@%m)[%h] %~ %% '
>
>
> these uses of '[[' are not supported by dash, although apparently posh
> supports them.
>
> I was trying to launch 'dash' from cmd.exe, in such a way that the
> default Windows values of TMP, TMPDIR, and TEMP were overridden.  For
> now I can do
>
>> set ENV=~/.dashinit
>> dash
>
> but...can we use /bin/test or a regular '[' here?
>
> --
> Chuck

Hello,

Can you please check which version of base-files here you using?
In 4.0-6 I have:

if [ ! "x${BASH_VERSION}" = "x"  ]; then
  HOSTNAME=$(/usr/bin/hostname)
  profile_d sh
  [ -f "/etc/bash.bashrc" ] && . "/etc/bash.bashrc"
elif [ ! "x${KSH_VERSION}" = "x" ]; then
  typeset -l HOSTNAME=$(/usr/bin/hostname)
  profile_d sh
  PS1=$(print '\033]0;${PWD}\n\033[32m${USER}@${HOSTNAME}
\033[33m${PWD/${HOME}/~}\033[0m\n$ ')
elif [ ! "x${ZSH_VERSION}" = "x" ]; then
  HOSTNAME=$(/usr/bin/hostname)
  profile_d zsh
  PS1='(%n@%m)[%h] %~ %% '
elif [ ! "x${POSH_VERSION}" = "x" ]; then
  HOSTNAME=$(/usr/bin/hostname)
  PS1="$ "
else
  HOSTNAME=$(/usr/bin/hostname)
  profile_d sh
  PS1="$ "
fi

As per:

Change Log
----------
4.0-6
    * Dropped non-POSIX tests in /etc/profile - Eric Blake
      cygwin.com/ml/cygwin/2011-03/msg00510.html

Maybe you modified /etc/profile preventing it to get updated before 4.0-6.

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