This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dash incompatibility in /etc/profile


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]