Mole icon indicating copy to clipboard operation
Mole copied to clipboard

[BUG] app_caches.sh: line 79: [[: 0 0: syntax error in expression (error token is "0")

Open Angelk90 opened this issue 7 months ago • 1 comments

Describe the bug

When I run the mo clean command I get the following error:

✓ Xcode unavailable simulators · already clean
/Users/NAMEUSER/.config/mole/bin/../lib/clean/app_caches.sh: line 79: [[: 0
0: syntax error in expression (error token is "0")

Version Channel: Nightly (49b156a)

Angelk90 avatar Apr 14 '26 13:04 Angelk90

Hey, found it! Snuck in with #714 (fb41fa2). grep -c prints 0 on no matches and exits with code 1, so || echo "0" fires too — leaving unavail_count as 0\n0, which breaks the [[ -gt 0 ]] comparison.

Fix is just borrowing the pattern dev.sh already uses:

unavail_count=$(xcrun simctl list devices unavailable 2>/dev/null | awk '/\([0-9A-F-]{36}\)/ {c++} END {print c+0}')
[[ "$unavail_count" =~ ^[0-9]+$ ]] || unavail_count=0

Happy to open a PR if that helps!

yetval avatar Apr 14 '26 17:04 yetval