The following code is well self-explained:
Output:
Reference:
1. Difference between $@ and $* - CSDN
© 2014-2017 jason4zhu.blogspot.com All Rights Reserved
If transfering, please annotate the origin: Jason4Zhu
bash test.sh 123 "456 7" 8 #!/bin/bash echo "--\"\$*\"--" for args in "$*" do echo "#"$args"#" done echo "--\$*--" for args in $* do echo "#"$args"#" done echo "--\"\$@\"--" for args in "$@" do echo "#"$args"#" done echo "--\$@--" for args in $@ do echo "#"$args"#" done
Output:
--"$*"-- #123 456 7 8# --$*-- #123# #456# #7# #8# --"$@"-- #123# #456 7# #8# --$@-- #123# #456# #7# #8#
Reference:
1. Difference between $@ and $* - CSDN
© 2014-2017 jason4zhu.blogspot.com All Rights Reserved
If transfering, please annotate the origin: Jason4Zhu
No comments:
Post a Comment