【问题标题】:define aliases for shell-command?为 shell 命令定义别名?
【发布时间】:2010-09-05 19:27:01
【问题描述】:

有没有办法定义别名以便shell-command 可以识别它们? shell 识别 .emacs.d/init_bash.sh 中定义的那些;是否可以让shell-command 也知道这些?

【问题讨论】:

    标签: emacs elisp


    【解决方案1】:

    simple.el 中读入shell-command 代码:

        ;; We do not use -f for csh; we will not support broken use of
        ;; .cshrcs.  Even the BSD csh manual says to use
        ;; "if ($?prompt) exit" before things which are not useful
        ;; non-interactively.  Besides, if someone wants their other
        ;; aliases for shell commands then they can still have them.
        (call-process shell-file-name nil
              (if error-file
                  (list t error-file)
                t)
              nil shell-command-switch command)
    

    shell-file-name 后面的nil 表示 emacs 不向进程发送输入文件。因此,您应该检查shell-file-name 的值以确定它是否是读取隐式.rc 文件的进程。

    【讨论】:

    • 我的 shell-file-name 是“bin/bash”,但我仍然不确定如何解释这些指令...?
    • man bash 以准确了解 bash 进程启动时所做的工作。
    • 谢谢 - 我创建了一个链接文件以便 /bin/bash 可以使用它。
    • 你能澄清 /bin/bash 的情况吗?指向 man bash 并没有太大帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-10
    • 1970-01-01
    • 1970-01-01
    • 2011-02-15
    • 1970-01-01
    相关资源
    最近更新 更多