3
0

bkslash_in_varexp.tests 523 B

12345678910111213141516
  1. x='a]'
  2. #
  3. # \] is not a valid escape for ] in set glob expression.
  4. # Glob sets have no escaping at all:
  5. # ] can be in a set if it is the first char: []abc],
  6. # dash can be in a set if it is first or last: [abc-],
  7. # [ and \ need no protections at all: [a[b\c] is a valid set of 5 chars.
  8. #
  9. # bash-4.3.43 misinterprets [a\]] as "set of 'a' or ']'".
  10. # Correct interpretation is "set of 'a' or '\', followed by ']'".
  11. #
  12. echo Nothing:${x#[a\]]}
  13. echo Nothing:"${x#[a\]]}"
  14. echo Nothing:${x%[a\]]}
  15. echo Nothing:"${x%[a\]]}"
  16. echo Ok:$?