var_wordsplit_ifs1.tests 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. set -- abc "d e"
  2. echo 'Testing: !IFS $*'
  3. unset IFS; for a in $*; do echo ".$a."; done
  4. echo 'Testing: !IFS $@'
  5. unset IFS; for a in $@; do echo ".$a."; done
  6. echo 'Testing: !IFS "$*"'
  7. unset IFS; for a in "$*"; do echo ".$a."; done
  8. echo 'Testing: !IFS "$@"'
  9. unset IFS; for a in "$@"; do echo ".$a."; done
  10. echo 'Testing: IFS="" $*'
  11. IFS=""; for a in $*; do echo ".$a."; done
  12. echo 'Testing: IFS="" $@'
  13. IFS=""; for a in $@; do echo ".$a."; done
  14. echo 'Testing: IFS="" "$*"'
  15. IFS=""; for a in "$*"; do echo ".$a."; done
  16. echo 'Testing: IFS="" "$@"'
  17. IFS=""; for a in "$@"; do echo ".$a."; done
  18. echo 'Testing: !IFS v=$*'
  19. unset IFS; v=$*; echo "v='$v'"
  20. echo 'Testing: !IFS v=$@'
  21. unset IFS; v=$@; echo "v='$v'"
  22. echo 'Testing: !IFS v="$*"'
  23. unset IFS; v="$*"; echo "v='$v'"
  24. echo 'Testing: !IFS v="$@"'
  25. unset IFS; v="$@"; echo "v='$v'"
  26. echo 'Testing: IFS="" v=$*'
  27. IFS=""; v=$*; echo "v='$v'"
  28. echo 'Testing: IFS="" v=$@'
  29. IFS=""; v=$@; echo "v='$v'"
  30. echo 'Testing: IFS="" v="$*"'
  31. IFS=""; v="$*"; echo "v='$v'"
  32. echo 'Testing: IFS="" v="$@"'
  33. IFS=""; v="$@"; echo "v='$v'"
  34. # Note: in IFS="" v=$@ and IFS="" v="$@" cases, bash produces "abc d e"
  35. # We produce "abcd e"
  36. echo Finished