gpt4 book ai didi

linux - 如何在继续我的脚本之前等待 dd 命令完成复制?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:24:58 24 4
gpt4 key购买 nike

标题几乎一目了然,我正在将文件复制到闪存驱动器,然后对这些文件执行一些操作。好吧,我注意到在运行 dd 命令后,闪存驱动器仍在闪烁,并不是所有文件都在设备上。

有谁知道如何运行一个简单的循环(在脚本中)来等待 dd 进程完成?我已经在谷歌上搜索了大约 2-3 个小时,现在试图找出它,如果可能的话,它超出了我的范围。

提前致谢!

最佳答案

试试sync命令:

sync writes any data buffered in memory out to disk. This can include (but is not limited to) modified superblocks, modified inodes, and delayed reads and writes. This must be implemented by the kernel; The sync program does nothing but exercise the sync system call.

The kernel keeps data in memory to avoid doing (relatively slow) disk reads and writes. This improves performance, but if the computer crashes, data may be lost or the file system corrupted as a result. The sync command ensures everything in memory is written to disk.

关于linux - 如何在继续我的脚本之前等待 dd 命令完成复制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9383932/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com