📅  最后修改于: 2022-03-11 14:51:50.003000             🧑  作者: Mango
STR="${STR//(^[ ]+|[ ]+$)/}"
# ${STR//--regex--/--replacement--} = replace all
# ${STR/--regex--/--replacement--} = replace one
# ^[ ]+ = empty character([ ])s(+) at the start(^) of the string
# [ ]+$ = empty character([ ])s(+) at the end($) of the string
# (A|B) = A or B