timmy hat die Gist bearbeitet 10 months ago. Zu Änderung gehen
1 file changed, 11 insertions
eject_usb.sh(Datei erstellt)
| @@ -0,0 +1,11 @@ | |||
| 1 | + | #!/bin/bash | |
| 2 | + | # Script to unmount and eject all external USB drives | |
| 3 | + | ||
| 4 | + | # 找到所有外接裝置並處理 | |
| 5 | + | diskutil list | grep "external, physical" | awk '{print $1}' | while read -r disk; do | |
| 6 | + | echo "Unmounting all volumes on $disk..." | |
| 7 | + | diskutil unmountDisk "$disk" | |
| 8 | + | echo "Ejecting $disk..." | |
| 9 | + | diskutil eject "$disk" | |
| 10 | + | done | |
| 11 | + | ||
Neuer
Älter