#### **1. Execution Efficiency**
* **Optimized Execution:** Streamlined from 4 external processes to just 2 (`df` and `awk`) by eliminating complex matrix transposition loops and string matching, significantly boosting execution speed and reducing overhead.
#### **2. Readability & Maintainability**
* **Clean Code:** Replaced 3 lines of convoluted logic with a single, clear pipeline.
#### **3. Robustness**
* **Anti-Wrapping:** The `-P` flag ensures the output stays on one line, preventing errors caused by long filesystem names that usually break `df` formatting.
* **Safe Defaults:** Uses `${1:-.}` to gracefully handle cases where no directory path is provided.
* **Dynamic Column Targeting:** Uses `$(NF-2)` to locate the "Available" column by position instead of fragile keyword filtering (e.g., "Available" or "可用"). This ensures locale-independence and correctly identifies the space value even if filesystem names contain spaces or if the system language changes.This is more robust than fixed column numbers because it correctly identifies the space value even if the filesystem name contains spaces or if the system adds extra trailing info.
#### **4. Seamless Compatibility**
* **Drop-in Replacement:** Fully supports your existing call patterns.
* **Zero Refactoring:** No changes are needed in the rest of your script to switch to this version.
- Use CASE statements instead of if-elif statements.
- Replace self-invoked with a while true loop.
- Wrap the inner function outside the parent function to prevent duplicate declarations caused by the while true loop.