bash/eshell,配上个脚本
if [ -z "$TTY" ]; then
TTY=/dev/tty
fi
while getopts "q:" opt; do
case $opt in
q)
QUERY="$OPTARG"
;;
*)
;;
esac
done
INPUT="$(mktemp)"
OUTPUT="$(mktemp)"
cat > "$INPUT"
# check ~/.emacs.d/init.el for MY_MINI
MY_MINI=true emacs -nw --eval "\
(with-temp-buffer
(insert-file-contents \"$INPUT\")
(let* ((lines (split-string (buffer-string) \"\n\" t))
(selection (completing-read \"Select: \" lines nil nil \"$QUERY\")))
(with-temp-file \"$OUTPUT\"
(insert selection)))
(kill-emacs))
" < "$TTY"
# (delete-frame) for emacsclient
cat "$OUTPUT"
rm -f "$INPUT" "$OUTPUT"
exit 0
脚本看情况,
- linux桌面的功能性脚本,不复杂dash
- 复杂点的python/elisp