param_expand_len.tests 449 B

123456789101112131415161718192021222324
  1. "$THIS_SH" -c 'echo $#'
  2. "$THIS_SH" -c 'echo $#' arg0
  3. "$THIS_SH" -c 'echo $#' arg0 arg1
  4. echo Make sure len parsing doesnt break arg count
  5. set --
  6. echo $# ${#}
  7. set -- aaaa bbb cc d
  8. echo $# ${#}
  9. echo Testing len op
  10. echo ${#1} ${#2} ${#3} ${#4} ${#5} ${#6}
  11. unset e
  12. f=abc
  13. g=
  14. echo ${#e} ${#f} ${#g}
  15. set -- a
  16. # This must be interpreted as: $# ("1"), then remove trailing "1".
  17. # IOW: empty result.
  18. echo Nothing:${##1}
  19. echo Nothing:${#%1}
  20. echo One:${##x}