【问题标题】:How to run shell command in specific path如何在特定路径中运行 shell 命令
【发布时间】:2019-04-16 08:00:30
【问题描述】:

在 emacs 中运行 shell 命令并不方便,尽管您可以运行 shell 引擎 (eshell tern) 或单独使用它 (zsh fish bash)。所以我认为有没有办法直接在特定文件路径中运行shell命令?

【问题讨论】:

  • 你到底是什么意思?子进程一般会在当前缓冲区的工作目录中运行
  • 就像通过 elisp 或任何其他第三方库在 ~/file/path 上运行 ls 一样
  • 喜欢(let ((default-directory "~/file/path")) (start-process "ls" "*ls output*" "ls")) 你的意思是?
  • 您可以手动选择文件路径并输入 shell 命令,而不是硬编码。
  • 如果将上述内容重构为交互式功能不是您知道如何着手解决的问题,那么您可能是在错误的网站上。

标签: shell emacs


【解决方案1】:

meta+x shell,然后使用 cd 到你的路径。

【讨论】:

    【解决方案2】:

    您可以将其作为子 shell 运行:

    ( cd ~/file/path/ && ls )
    

    【讨论】:

      猜你喜欢
      • 2017-08-25
      • 2012-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-28
      • 1970-01-01
      • 1970-01-01
      • 2023-03-21
      相关资源
      最近更新 更多