files=("Benjamin Johnson" "Bastin Johnson" "Bagio Johnson")
( IFS=','; echo "${files[*]/#/Mr.}"; echo "${files[*]/ /_}" )
预期结果
Mr.Benjamin_Johnson,Mr.Bastin_Johnson,Mr.Bagio_Johnson
输出结果:
Mr.Benjamin Johnson,Mr.Bagio Johnson,Mr.Bastin Johnson
Benjamin_Johnson,Bagio_Johnson,Bastin_Johnson