我需要在我的脚本中卸载某些内容,但有时它会在所有数据完成复制之前卸载并导致卸载失败。我寻找一种方法来进行“阻塞”卸载,但我什么也没找到。所以,我试图编写一个脚本来循环直到它可以被卸载,但它不起作用。
while [ `sudo umount mount` ]
do
sleep 0.1
done
rmdir mount
Run Code Online (Sandbox Code Playgroud)
运行输出时:
umount: /home/evantandersen/mount: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
rmdir: failed to remove `mount': Device or resource busy
Run Code Online (Sandbox Code Playgroud)
它不应该循环直到返回值为sudo umount mount
0,这意味着它已成功卸载吗?