Bash 为什么重定向在我的shell脚本中不起作用?
我试图找到关键字并将它们重定向到文件。我可以在终端上看到结果,但这些结果不会在txt文件中重定向Bash 为什么重定向在我的shell脚本中不起作用?,bash,shell,io-redirection,Bash,Shell,Io Redirection,我试图找到关键字并将它们重定向到文件。我可以在终端上看到结果,但这些结果不会在txt文件中重定向 find /opt/IBM /opt/ibm /usr/IBM /usr/ibm \( -name db2licm -o -name onstat -o -name versionInfo.sh -o -name WPVersionInfo.sh \) 2>>/tmp/versiondocument.txt 我希望versiondocument.txt中db2licm,versioni
find /opt/IBM /opt/ibm /usr/IBM /usr/ibm \( -name db2licm -o -name onstat -o -name versionInfo.sh -o -name WPVersionInfo.sh \) 2>>/tmp/versiondocument.txt
我希望
versiondocument.txt中db2licm
,versioninfo.sh
的路径是versiondocument.txt
您只能使用2>
重定向错误。请尝试以下示例:
$find
.
/b
/b/file.txt
/b/b.txt
/a
/a/a.txt
/a/c.txt
/tmp.log
$find a b-name file.txt-o-name a.txt>>tmp.log
$cat tmp.log
a/a.txt
b/file.txt
你需要转义parensa你可以看到,在OP的调用中parens()(
)是转义的,但在你的调用中它们不是,你说它是OP的mistake@oguzismail不,第一篇文章(编辑之前)没有转义的()
。所以我的回答是正确的:p我已经移除了它。好吧,那么,移除了我的