我需要使用:
grep -rio pattern --exclude-dir=".config/dir1*" --exclude-dir=".test*"
Run Code Online (Sandbox Code Playgroud)
为了避免grep
名称中包含和pattern
的所有文件夹,.config/dir1
.test
例如.config/dir1
,.config/dir1/dir2
、 、.test
和./other/.test
应排除在外。
我所做的并没有排除这些文件夹,你能帮我吗?
谢谢
我正在编写一个 bash 脚本,我需要捕获由rsync
命令输出产生的文本,例如,以下命令:
rsync -av "$FOLDER1" "$FOLDER2"
Run Code Online (Sandbox Code Playgroud)
印刷:
...
sent 109,423 bytes received 352 bytes 219,550.00 bytes/sec
...
Run Code Online (Sandbox Code Playgroud)
我想捕获该行 ( sent 109,423 bytes received 352 bytes 219,550.00 bytes/sec
) 并将该字符串放入脚本中的变量中。
我怎样才能做到这一点?