Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从bashshell运行Logparser_Bash_Sh_Logparser - Fatal编程技术网

如何从bashshell运行Logparser

如何从bashshell运行Logparser,bash,sh,logparser,Bash,Sh,Logparser,我在Windows box上 我打开git bash shell并运行 logparser从testFile.log-i:IISW3C-o:CSV中选择日期 这很有效 但是如果我用 cmd_to_run='logparser "select date from testFile.log" -i:IISW3C -o:CSV' $cmd_to_run 这不起作用,我得到logparser错误: 错误:在查询后检测到额外的参数select 我只需要通过.sh脚本运行logparser。 您能帮忙吗?

我在Windows box上 我打开git bash shell并运行

logparser从testFile.log-i:IISW3C-o:CSV中选择日期

这很有效

但是如果我用

cmd_to_run='logparser "select date from testFile.log" -i:IISW3C -o:CSV'
$cmd_to_run
这不起作用,我得到logparser错误:

错误:在查询后检测到额外的参数select

我只需要通过.sh脚本运行logparser。
您能帮忙吗?

首先,为什么不直接运行它呢

转义查询中的空白,因为bash将其展开,并且您将位置参数提供给logparser,而不是保留的字符串。如果不起作用,请尝试评估

为了说明这一点,下面是一个与wc类似的示例:

$ wc -w <<< "select date from testFile.log"
4
$ cmd_to_run='wc -w <<< "select date from testFile.log"'
$ $cmd_to_run
wc: <<<: No such file or directory
wc: "select: No such file or directory
wc: date: No such file or directory
wc: from: No such file or directory
wc: testFile.log": No such file or directory
0 total
$ eval $cmd_to_run # quote as appropriate
4