Uggh.

At least for the connect side use adb wait-for-device, followed by the adb shell ls (if needed). No need for quotes around the ls.