Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用以下命令来查找文件名,并且在从命令行执行时工作正常:
$AIX->: find . | xargs grep -l "BE00036" ./6281723219129 $AIX->:
但是从 shell 脚本(ksh)执行时,相同的命令不起作用:
$AIX->: ksh test.ksh **find: bad option -l**
我的部分代码是:
Var="find . | xargs grep -l \"BE00036\" print `$Var`
如果要将命令的输出分配给变量,可以执行
Var="$(find . | xargs grep -l \"BE00036\")" print "$Var"
下面这个对我有用:
var=`find . | xargs grep -l 'BE00036'` echo "$var"