@msw有正确的想法(在问题的评论中)。然而,另一个用引号打印参数的想法:使用printf的隐式迭代:
foo() { printf '"%s" ' "$@"; echo ""; } foo bla "hello ppl" # => "bla" "hello ppl"
foo() { printf '"%s" ' "$@"; echo ""; } foo bla "hello ppl" # => "bla" "hello ppl"