diff --git a/bin/fzf-tmux b/bin/fzf-tmux index 4db037c..d945c15 100755 --- a/bin/fzf-tmux +++ b/bin/fzf-tmux @@ -50,13 +50,19 @@ cleanup() { } trap cleanup EXIT SIGINT SIGTERM +fail() { + >&2 echo "$1" + exit 1 +} +fzf=$(which fzf 2> /dev/null) || fail "fzf executable not found" + mkfifo $fifo2 mkfifo $fifo3 if [ -t 0 ]; then - tmux split-window $opt 'bash -c "fzf '"$fzf_args"' > '$fifo2'; echo \$? > '$fifo3'"' + tmux split-window $opt 'sh -c "'$fzf' '"$fzf_args"' > '$fifo2'; echo \$? > '$fifo3'"' else mkfifo $fifo1 - tmux split-window $opt 'bash -c "fzf '"$fzf_args"' < '$fifo1' > '$fifo2'; echo \$? > '$fifo3'"' + tmux split-window $opt 'sh -c "'$fzf' '"$fzf_args"' < '$fifo1' > '$fifo2'; echo \$? > '$fifo3'"' cat <&0 > $fifo1 & fi cat $fifo2