Jump to content

Template:egStartApps

From RaySoft

Syntax

{{egStartApps}}

Usage

Code

{{egStartApps}}

Result

Start applications in macOS if they exist and are not already started
vi "${HOME}/dev/lib/os.sh"
os::start_apps() {
  for app in "${@}"; do
    if ! open -a "${app}.app" -R >'/dev/null' 2>&1; then
      nf::carp "Error finding application: ${app}!"

      continue
    fi

    app="/Applications/${app}.app"

    if ! pgrep -f -q "${app}"; then
      open -a "${app}"
    fi
  done
}
os::start_apps 'Bitwarden'