O'Reilly logo
  • QIAN Weishuo thinks this is interesting:

  • "$@" expands as "$1" "$2" "$3" and so on
  • "$*" expands as "$1c$2c$3", where c is the first character of IFS
  • "$@" is used more often than $*, since the former provides all arguments as a single string
  • From

    Cover of Linux Shell Scripting Cookbook - Third Edition

    Note

    加上双引号才能看出区别,"$*"是一个整体字符串,用$IFS的第一个字符join起来的。而 "$@"是个数组