[SPARK-3584] sbin/slaves doesn't work when we use password authentication for SSH

Typically for these types of options we just check whether it's defined or not. For example elsewhere we do:

```
if [ -n "$SPARK_PRINT_LAUNCH_COMMAND" ]; then
```

Can you make it consistent with that?