📜  shell trim - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:51:50.003000             🧑  作者: Mango

代码示例1
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