我有这个简短的片段:
#!/usr/bin/env bash touch a_b c_d e_f p=a printf '%s\n' "Not quoted" ./$p_* printf '%s\n' "" "Quoted" ./"$p"_*
输出:
Not quoted ./a_b ./c_d ./e_f Quoted ./a_b