On Wed, Nov 21, 2018 at 01:29:24PM +0900, Masanori Ogino wrote:
> >Synopsis:    ksh: case statement in command substitution raises a syntax 
> >error
> >Category:    system
> >Environment:
>       System      : OpenBSD 6.4
>       Details     : OpenBSD 6.4 (GENERIC.MP) #364: Thu Oct 11 13:30:23 MDT 
> 2018
>                        
> [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> 
>       Architecture: OpenBSD.amd64
>       Machine     : amd64
> >Description:
> 
> All of four commands below shall output "OK":
> 
> 1. (case 1 in (1) echo OK;; esac)
> 2. (case 1 in 1) echo OK;; esac)
> 3. echo $(case 1 in (1) echo OK;; esac)
> 4. echo $(case 1 in 1) echo OK;; esac)
> 
> With OpenBSD ksh(1), however, all but 4. behave as expected.
> 
> $ (case 1 in (1) echo OK;; esac)
> OK
> $ (case 1 in 1) echo OK;; esac)
> OK
> $ echo $(case 1 in (1) echo OK;; esac)
> OK
> $ echo $(case 1 in 1) echo OK;; esac)
> ksh: syntax error: `;;' unexpected
> 
> It seems a bug in eval.c but I could not find where it exactly is.
> 
> The problem initially targeted bash and zsh, and was described
> in the following (Japanese) article:
> 
> https://qiita.com/richmikan@github/items/8eebbacc73f80c18a728

This is a known limitation: http://man.openbsd.org/ksh#BUGS

Reply via email to