Fix: Remove ternary operators causing syntax errors
Issue: Bash arithmetic expansion does not support ternary operators Lines 1789-1791 used: base_risk=$((base_risk < 2 ? base_risk : base_risk - 1)) This caused syntax error: "error token is..." Fix: Replace ternary operators with proper conditional logic: - [ "$has_tty" -eq 1 ] && [ "$base_risk" -gt 1 ] && base_risk=$((base_risk - 1)) This achieves the same result (prevent risk from going below 1) without using unsupported ternary syntax. Testing: ✓ Syntax validation passed ✓ Script runs without errors Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1786,9 +1786,9 @@ check_recent_password_changes() {
|
|||||||
local base_risk=5
|
local base_risk=5
|
||||||
[ "$admin_active" -eq 1 ] && base_risk=2
|
[ "$admin_active" -eq 1 ] && base_risk=2
|
||||||
[ "$safe_window" -eq 1 ] && base_risk=2
|
[ "$safe_window" -eq 1 ] && base_risk=2
|
||||||
[ "$has_tty" -eq 1 ] && base_risk=$((base_risk < 2 ? base_risk : base_risk - 1))
|
[ "$has_tty" -eq 1 ] && [ "$base_risk" -gt 1 ] && base_risk=$((base_risk - 1))
|
||||||
[ "$login_recent" -eq 1 ] && base_risk=$((base_risk < 2 ? base_risk : base_risk - 1))
|
[ "$login_recent" -eq 1 ] && [ "$base_risk" -gt 1 ] && base_risk=$((base_risk - 1))
|
||||||
[ "$in_maintenance" -eq 1 ] && base_risk=$((base_risk < 2 ? base_risk : base_risk - 1))
|
[ "$in_maintenance" -eq 1 ] && [ "$base_risk" -gt 1 ] && base_risk=$((base_risk - 1))
|
||||||
risk=$((risk + base_risk))
|
risk=$((risk + base_risk))
|
||||||
details="${details}Single-user:$filtered_users "
|
details="${details}Single-user:$filtered_users "
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user