Some WP-CLI commands are made for scripts, not for people. This one prints nothing at all.
wp core is-installed answers with its exit code: 0 when WordPress is installed in the database, non-zero when it is not. That makes it a clean condition for a setup script:
if ! wp core is-installed 2>/dev/null; then
wp core install --url=https://example.com --title="Example" \
--admin_user=admin [email protected] --skip-email
fi
The 2>/dev/null keeps error text out of the output when the database is still empty. I like this pattern for container setups, where the same entrypoint runs on the first start and every start after it. The install only happens once.
On multisite, add --network to check that the install is a network.
What it checks is the database, not the files. A folder with WordPress files and a wp-config.php pointing at an empty database counts as not installed. And when the database cannot be reached at all, you also get a non-zero exit. So in a script that matters, check the connection first with wp db check, or a failed connection could trigger a second install attempt.
Further reading: wp core is-installed, wp core install