Re: dash incompatibility in /etc/profile

2011-08-24 Thread David Sastre
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



Re: dash incompatibility in /etc/profile

2011-08-24 Thread Charles Wilson
On 8/24/2011 7:40 AM, David Sastre wrote:
 Can you please check which version of base-files here you using?
 In 4.0-6 I have:

4.0-6.

 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.

I guess I must have done so, but I don't remember doing it.  I'll update
from /etc/defaults/ and see what breaks because the default files are
missing whatever mods I made.

--
Chuck



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



dash incompatibility in /etc/profile

2011-08-21 Thread Charles Wilson
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

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