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.
我认为在我的 bash 脚本中进行同步会强制文件被完全写出。当我查看 U 盘时,它显示了我复制的所有文件,但在电源故障后,U 盘显示 0 个文件。我必须手动弹出驱动器还是可以在我的脚本中以编程方式执行某些操作?
如果您想从您的 bash 脚本中弹出 USB 设备,umount那么设备上的简单操作应该可以解决问题。例如
umount
mount /dev/usb /mnt/usb # Your copy operations here... then on success: umount /mnt/usb
如果您的 USB 密钥正在使用日志文件系统,您还可以尝试使用 linux 同步指令来同步写入磁盘