glob2.tests 710 B

123456789101112131415161718192021222324252627
  1. # This test demonstrates that in unquoted $v, backslashes expand by this rule:
  2. # \z -> \\\z; \<eol> -> \\<eol> (for any z, special or not),
  3. # and subsequently globbing converts \\ to \ and treats \z as literal z
  4. # even if it is a special char.
  5. >'Zf'
  6. >'Z\f'
  7. echo 'Expected' 'Actual'
  8. v='\*'; echo 'Z\* :' Z$v
  9. echo 'Z* :' Z\*
  10. echo 'Z\f :' Z\\*
  11. echo 'Z\* :' Z\\\* # NB! only this matches Z$v output
  12. echo
  13. v='\z'; echo 'Z\z :' Z$v
  14. echo 'Zz :' Z\z
  15. echo 'Z\z :' Z\\z
  16. echo 'Z\z :' Z\\\z
  17. echo
  18. v='\'; echo 'Z\ :' Z$v
  19. echo 'Z\ :' Z\\
  20. echo
  21. v='*'; echo 'Z\f Zf :' Z$v
  22. echo 'Z\f Zf :' Z*
  23. echo
  24. rm 'Z\f' 'Zf'
  25. echo Done: $?