param_expand_assign.tests 874 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. # first try some invalid patterns (do in subshell due to parsing error)
  2. "$THIS_SH" -c 'echo ${=}'
  3. "$THIS_SH" -c 'echo ${:=}'
  4. # now some funky ones
  5. "$THIS_SH" -c 'echo ${#=}'
  6. "$THIS_SH" -c 'echo ${#:=}'
  7. # should error out
  8. "$THIS_SH" -c 'set --; echo _${1=}'
  9. "$THIS_SH" -c 'set --; echo _${1:=}'
  10. "$THIS_SH" -c 'set --; echo _${1=word}'
  11. "$THIS_SH" -c 'set --; echo _${1:=word}'
  12. # should not error
  13. "$THIS_SH" -c 'set aa; echo _${1=}'
  14. "$THIS_SH" -c 'set aa; echo _${1:=}'
  15. "$THIS_SH" -c 'set aa; echo _${1=word}'
  16. "$THIS_SH" -c 'set aa; echo _${1:=word}'
  17. # should work fine
  18. unset f; echo _$f
  19. unset f; echo _${f=}
  20. unset f; echo _${f:=}
  21. unset f; echo _${f=word}
  22. unset f; echo _${f:=word}
  23. f=; echo _$f
  24. f=; echo _${f=}
  25. f=; echo _${f:=}
  26. f=; echo _${f=word}
  27. f=; echo _${f:=word}
  28. f=fff; echo _$f
  29. f=fff; echo _${f=}
  30. f=fff; echo _${f:=}
  31. f=fff; echo _${f=word}
  32. f=fff; echo _${f:=word}