如何使用位于该驱动器上的脚本卸载 USB 驱动器?脚本运行时,设备显示忙碌,
答案1
首次尝试&
#!/bin/sh -xv
#Get device where I am located
DEV=$(df -k "$0" | tail -1 | awk '{ print $1 }')
echo $DEV
#Create umount script
echo '#!/bin/sh -xv' >/tmp/udisk.tmp
echo "umount $DEV" >>/tmp/udisk.tmp
cat /tmp/udisk.tmp
chmod +x /tmp/udisk.tmp
#Run the script
/tmp/udisk.tmp &