All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Login


All New Login

All gists matching topic unmount

Recently created
Least recently created
Recently updated
Least recently updated

timmy / 卸載與彈出外接 USB 裝置腳本

0 likes
0 forks
1 files
Last active 9 months ago
此腳本可自動尋找、卸載並彈出所有外接 USB 裝置,確保安全移除磁碟並避免資料損毀。
ShellScript USB diskutil eject unmount
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
Newer Older

Powered by Opengist ⋅ Load: 12ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文