909fcef0469a2706508c0197e14aa45654702044

Author
hjpotter92 <hjpotter92@users.noreply.github.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Fix issue with `dash` as the default `/bin/sh` script executing program. (#5177)

* `function` keyword removed
 * Fixup the `if` statement and operators

Diff

 1diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh
 2index d61ebb15b38d76c2652394f9ebb68c7cf10d40ff..41682512ddd6e1d5da70ce8e785f954c3918a260 100755
 3--- a/plugins/emacs/emacsclient.sh
 4+++ b/plugins/emacs/emacsclient.sh
 5@@ -1,6 +1,6 @@
 6 #!/bin/sh
 7 
 8-function _emacsfun
 9+_emacsfun()
10 {
11     # get list of available X windows.
12     x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
13@@ -18,7 +18,8 @@ function _emacsfun
14 # adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh
15 # If the second argument is - then write stdin to a tempfile and open the
16 # tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
17-if [[ $# -ge 2 ]] && [[ "$2" == - ]]; then
18+if [ "$#" -ge "2" -a "$2" = "-" ]
19+then
20     tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
21     cat - > "$tempfile"
22     _emacsfun --no-wait $tempfile