#!/bin/sh

if [ -d /Applications/ ]; then
  open --background "$@" 2>/dev/null &
  exit 0
fi

# if [ -e /Applications ]; then
#   open --background -a Firefox "$@" 2>/dev/null &
#   exit 0
# fi

if [ -e /usr/bin/firefox ]; then
  /usr/bin/firefox "$@" 2>/dev/null &
  exit 0
fi

if [ -e /opt/homebrew/bin/firefox ]; then
  /opt/homebrew/bin/firefox "$@" 2>/dev/null &
  exit 0
fi

# fallback: might be a headless system
echo "$@" | less
exit 0
