mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-27 15:30:15 +08:00
Fix issue with dash
as the default /bin/sh
script executing program. (#5177)
* `function` keyword removed * Fixup the `if` statement and operators
This commit is contained in:
parent
d012402dad
commit
909fcef046
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
function _emacsfun
|
_emacsfun()
|
||||||
{
|
{
|
||||||
# get list of available X windows.
|
# get list of available X windows.
|
||||||
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
|
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
|
||||||
@ -18,7 +18,8 @@ function _emacsfun
|
|||||||
# adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh
|
# adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh
|
||||||
# If the second argument is - then write stdin to a tempfile and open the
|
# If the second argument is - then write stdin to a tempfile and open the
|
||||||
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
|
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
|
||||||
if [[ $# -ge 2 ]] && [[ "$2" == - ]]; then
|
if [ "$#" -ge "2" -a "$2" = "-" ]
|
||||||
|
then
|
||||||
tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
|
tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
|
||||||
cat - > "$tempfile"
|
cat - > "$tempfile"
|
||||||
_emacsfun --no-wait $tempfile
|
_emacsfun --no-wait $tempfile
|
||||||
|
Loading…
Reference in New Issue
Block a user