public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* dash incompatibility in /etc/profile
@ 2011-08-21 18:51 Charles Wilson
  2011-08-24 11:40 ` David Sastre
  0 siblings, 1 reply; 3+ messages in thread
From: Charles Wilson @ 2011-08-21 18:51 UTC (permalink / raw)
  To: Cygwin Mailing List

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dash incompatibility in /etc/profile
  2011-08-21 18:51 dash incompatibility in /etc/profile Charles Wilson
@ 2011-08-24 11:40 ` David Sastre
  2011-08-24 13:28   ` Charles Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: David Sastre @ 2011-08-24 11:40 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dash incompatibility in /etc/profile
  2011-08-24 11:40 ` David Sastre
@ 2011-08-24 13:28   ` Charles Wilson
  0 siblings, 0 replies; 3+ messages in thread
From: Charles Wilson @ 2011-08-24 13:28 UTC (permalink / raw)
  To: Cygwin Mailing List

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-24 13:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-21 18:51 dash incompatibility in /etc/profile Charles Wilson
2011-08-24 11:40 ` David Sastre
2011-08-24 13:28   ` Charles Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).