我需要在脚本中卸载某些内容,但有时需要先卸载所有数据,然后再完成卸载,导致卸载失败。我正在寻找一种方法来进行“阻止”卸载,但是我什么也没找到。因此,我尝试编写一个脚本来循环,直到可以将其卸载为止,但是它不起作用。
while [ `sudo umount mount` ]
do
sleep 0.1
done
rmdir mount
运行时输出:
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
它不应该循环直到返回值sudo umount mount
0表示已成功卸载吗?