在命令行中运行 awk 程序时出错:"^ backslash not last character on line"



遵循手动凝视 https://www.gnu.org/software/gawk/manual/gawk.html

我正在使用awk扩展在Visual Studio代码中编写第一个示例:

awk 'BEGIN { print "Don47t Panic!" }'

控制台向我返回此错误:

^ 反斜杠不是行上的最后一个字符

可能是什么问题?

我认为这可能是您的awk版本的错误,或者vscode可能会解析47的某种方式? 给我的。。。直接从 Linux 命令行,没有问题。

$ awk -V
GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.1.2)
Copyright (C) 1989, 1991-2018 Free Software Foundation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
$ awk 'BEGIN { print "Don47t Panic!" }'
Don't Panic!

最新更新