From 902f734cfb825eb44a7b25ee2111b66c939bf83d Mon Sep 17 00:00:00 2001 From: Misaka Mikoto Date: Mon, 3 Jun 2019 21:16:11 +1000 Subject: [PATCH] bin/doom POSIX compliance --- bin/doom | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/doom b/bin/doom index 9d7cf21fe..f2aab55c8 100755 --- a/bin/doom +++ b/bin/doom @@ -1,13 +1,13 @@ -#!/usr/bin/env bash -":"; [[ $EMACS = *"term"* ]] && EMACS=emacs || EMACS=${EMACS:-emacs} # -*-emacs-lisp-*- +#!/bin/sh +":"; ( echo "$EMACS" | grep -q "term" ) && EMACS=emacs || EMACS=${EMACS:-emacs} # -*-emacs-lisp-*- ":"; command -v $EMACS >/dev/null || { >&2 echo "Emacs isn't installed"; exit 1; } ":"; VERSION=$($EMACS --version | head -n1) -":"; [[ $VERSION == *\ 2[0-2].[0-1].[0-9] ]] && { echo "You're running $VERSION"; echo "That version is too old to run Doom. Check your PATH"; echo; exit 2; } -":"; DOOMBASE=$(dirname "${BASH_SOURCE:-${(%):-%x}}")/.. -":"; [[ $1 == -d || $1 == --debug ]] && { shift; export DEBUG=1; } -":"; [[ $1 == doc || $1 == doctor ]] && { cd "$DOOMBASE"; shift; exec $EMACS --script bin/doom-doctor "$@"; exit 0; } -":"; [[ $1 == run ]] && { cd "$DOOMBASE"; shift; exec $EMACS -q --no-splash -l bin/doom "$@"; exit 0; } -":"; exec $EMACS --script "$0" -- $@ +":"; case "$VERSION" in *\ 2[0-2].[0-1].[0-9]) echo "You're running $VERSION"; echo "That version is too old to run Doom. Check your PATH"; echo; exit 2 ;; esac +":"; DOOMBASE=$(dirname "$0")/.. +":"; [ "$1" = -d ] || [ "$1" = --debug ] && { shift; export DEBUG=1; } +":"; [ "$1" = doc ] || [ "$1" = doctor ] && { cd "$DOOMBASE"; shift; exec $EMACS --script bin/doom-doctor "$@"; exit 0; } +":"; [ "$1" = run ] && { cd "$DOOMBASE"; shift; exec $EMACS -q --no-splash -l bin/doom "$@"; exit 0; } +":"; exec $EMACS --script "$0" -- "$@" ":"; exit 0 (defun usage ()