假设变量包含空格,换行符和制表符后跟一些文本,为什么会这样:
原文链接:https://www.f2er.com/bash/384717.html${var#"${var%%[![:space:]]*}"} # strip var of everything # but whitespace # then remove what's left # (i.e. the whitespace) from var
删除空格并保留文本,但是这样:
${var##[:space:]*} # strip all whitespace from var
才不是?