我需要编写一个bash脚本,第一个工作是从arcsight ESM导出包。 之后它需要将导出的档案移动到连接器服务器,但我还没有涉及到该部分。 我的问题是这样的:根据arcsight ESM手册,用于导出软件包的命令如下:
arcsight package –action export –package “/All Packages/Personal/Mypackage” –f packagebundle.arb –u username –p password –m managername该命令只需要从ESM服务器上的arcsight主目录运行,否则bash不会将arcsight识别为命令。 我这样做,该命令似乎运行正常,因为它设法登录到ESM,返回说它正在导出包但后来我得到
国旗''不被识别
它停止了 它没有完成导出包,因为在运行命令后目标文件夹中没有“packagebundle.arb”文件。 所以我想问一下是否有人知道这个错误是什么以及如何解决它。 直到现在才发现它。 ArcSight版本为6.9,Linux版本为RHEL 5.5。
I need to write a bash script who's first job is to export a package from an arcsight ESM. afterwards it needs to move the exported archives to a connector server but i haven't gotten to that part yet. my issue is this: as per the arcsight ESM manual, the command for exporting the package is the following:
arcsight package –action export –package “/All Packages/Personal/Mypackage” –f packagebundle.arb –u username –p password –m managernamethe command needs to be run from the arcsight home directory on the ESM server only, else bash doesn't recognize arcsight as a command. i did that, the command seems to run fine as it does manage to log in to ESM, return says it's exporting the package but then i get
The Flag '' is not recognized
and it stops. it doesn't finish exporting the package as there is no "packagebundle.arb" file in the destination folder after the running the command. so i'd like to ask if anyone has some idea about what this error is and how to fix it. couldn't find much about it until now. ArcSight version is 6.9 and linux version is RHEL 5.5.
最满意答案
我认为问题在于你引用一个卷曲的引用,如下所示:“,而不是直引用,如下:”。
一些文本编辑器将直引号更改为卷曲,因为它们看起来更好。 但是,这会破坏shell可执行文件,因为它不能识别引号。
这里是你的命令应该看起来像直引号arcsight package –action export –package "/All Packages/Personal/Mypackage" –f packagebundle.arb –u username –p password –m managername
示例:使用直引号和卷曲引号进行回显
直引号:
echo "test" > testQurly引用:
echo “test“ > “test“正如你所看到的,bash没有将“解释为”。
I think the problem is that you are quoting with a curly quote, like this: “, instead of a straight quote, like this: ".
Some text editors change straight quotes to curly because they looks better. This does however break shell executables, because it does not recognize curly quotes.
Here is what your command should look like with straight quotes arcsight package –action export –package "/All Packages/Personal/Mypackage" –f packagebundle.arb –u username –p password –m managername
Example: echoing with straight vs curly quotes
Straight quotes:
echo "test" > testQurly quotes:
echo “test“ > “test“As you can see bash does not interpret “ as a quote.
更多推荐
发布评论