[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
case inside $(while true) misparsed
From: |
Kjetil Torgrim Homme |
Subject: |
case inside $(while true) misparsed |
Date: |
Wed, 01 Nov 2017 12:04:10 +0100 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/opt/bash/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -g -O2
-Wno-parentheses -Wno-format-security
uname output: Linux scribus.ms.redpill-linpro.com 4.11.12-200.fc25.x86_64 #1
SMP Fri Jul 21 16:41:43 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu
Bash Version: 4.4
Patch Level: 12
Release Status: release
Description:
I was bitten by earlier iterations of case selectors prematurely ending
an $()
and my actual problem has been patched in the newest release (thanks!). I came
across a
degenerate case in my testing, though.
Repeat-By:
foo=$(while true; do case $HOME in /*) echo abs ;; esac; done)
bash: syntax error near unexpected token `;;'
It works if you replace "true" with "false", or even with ":" (in which
case it
loops endlessly as it should)
Workaround:
Use backticks, or don't write degenerate code.
- case inside $(while true) misparsed,
Kjetil Torgrim Homme <=