小编Bya*_*gan的帖子

如何在shell脚本中使用grep在while循环中使用命令的否定?

有什么方法可以同时使用 while 循环和 grep 吗?看我的例子:

while  [[  !(grep -R -h "${text}" ${path}) ]];
do
    ...
done
Run Code Online (Sandbox Code Playgroud)

它说:

./test_script.sh: line 1: conditional binary operator expected
./test_script.sh: line 1: expected `)'
./test_script.sh: line 1: syntax error near `-R'
./test_script.sh: line 1: `while  [[  !(grep -R -h "${text}" ${path}) ]];'
Run Code Online (Sandbox Code Playgroud)

grep bash shell-script test

2
推荐指数
1
解决办法
4537
查看次数

标签 统计

bash ×1

grep ×1

shell-script ×1

test ×1