perhaps instead of ls, use [[ -r $PROGRAM ]]