Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • POSIXly is ideal because it will work with the (arguably better) dash. Commented Dec 4, 2015 at 13:52
  • zsh seems to have problem with [![:blank:]], it raise :b is invalid modifier. In sh and ksh emulate, it raise event not found for [ Commented Jan 21, 2016 at 16:03
  • @cuonglm, what did you try? var=foo zsh -c 'case ${var+x$var} in (x*[![:blank:]]*) echo x; esac' is OK for me. The event not found would only be for interactive shells. Commented Jan 21, 2016 at 16:27
  • @StéphaneChazelas: Ah, right, I tried with interactive shells. The :b invalid modifier is a bit strange. Commented Jan 21, 2016 at 16:53
  • 1
    @FranklinYu, on OS/X sh is bash built with --enable-xpg-echo-default and --enable-strict-posix-default so as to be Unix compliant (which involves echo '\t' outputting a tab). Commented Aug 9, 2016 at 20:20