bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problems with a subshell in .profile


From: Chet Ramey
Subject: Re: problems with a subshell in .profile
Date: Sun, 18 Oct 2009 20:51:31 -0400
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

Nils wrote:
> I use a shared .profile for bash and ksh93, I have a ksh93 specific
> section which I want to separate through the following construct:
> 
> if ( test -n "${.sh.version}" ) 2>/dev/null; then
>     echo "ksh"
> fi
> 
> bash just hangs while it works in POSIX shell and ksh93. A bash script
> with above contents also works as expected.
> Why is this?

This is a bug.  The shell doesn't hang (type a command, and you'll get
output), but the bad substitution causes a longjmp back to the subshell's
top level, and it's trying to read input from the terminal.  You don't
see anything because that shell's stdout is redirected to /dev/null.
This will be fixed in bash-4.1.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]