除了我的例外,元字符(例如?
)不需要转义,为什么在以下情况下需要转义?我在debian-stretch上运行。
$ echo ab|sed 's/ab?//g'
ab
$ echo a|sed 's/ab?//g'
a
$ echo ab|sed 's/ab\?//g'
$ echo a|sed 's/ab\?//g'
$ sed --version
sed (GNU sed) 4.4
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jay Fenlason, Tom Lord, Ken Pizzini,
and Paolo Bonzini.
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-sed@gnu.org>.
$