#! /bin/bash
silent_background() {
  { 2>&3 "$@"& } 3>&2 2>/dev/null
  disown &>/dev/null  # Prevent whine if job has already completed
}

init(){
  [ -z "$HOME_BIN" ] && echo "HOME_BIN is not set!" && exit 1
  [ ! -d "$HOME_BIN" ] && mkdir -p "$HOME_BIN"
  [[ ! "$PATH" =~ "$HOME_BIN" ]] && PATH=$PATH:$HOME_BIN
  [[ ! "$PATH" =~ "~/.local/bin" ]] && PATH=$PATH":~/.local/bin/"
  [[ ! "$PATH" =~ "/var/lib/snapd/snap/bin" ]] && PATH=$PATH":/var/lib/snapd/snap/bin"
  if ! [[ `findmnt -M ~/cloud` ]]; then
    echo "" > /dev/null
    # silent_background cloud
  fi
}
