Getting macOS app bundle ID

from blog lmno.lol @alvaro, | ↗ original
From stack overflow: Option 1 osascript -e 'id of app "Emacs"' Option 2 mdls -name kMDItemCFBundleIdentifier -r SomeApp.app