要创建一个 StartExplorer 自定义命令,该命令会打开 Cygwin 终端并在所选资源的文件系统位置启动交互式 Bash shell,请执行以下步骤:
- 确保安装chere
Cygwin 包;
- 安装StartExplorer
Eclipse 插件;
- 在插件 StartExplorer 的 Eclipse Preferences 中,创建一个新的自定义命令:
- 命令:
D:\cygwin64\bin\mintty.exe -e /bin/xhere /bin/bash
"${selected_resource_loc}"
- 为资源启用:
yes
- 资源菜单名称:
Cygwin Bash Here
- 资源类型:
Folders
作为步骤 2 和 3 的替代方法,如果您不关心上下文菜单条目,则无需安装 StartExplorer 插件。EclipseExtenal Tools Configuration
标准特性可以解决问题。
在Run > Extenal Tools Configuration
中,创建一个新程序:
- 姓名:
Cygwin Bash Here
- 地点:
D:\cygwin64\bin\mintty.exe
- 论据:
-e /bin/xhere /bin/bash "${selected_resource_loc}"
基本上,xhere
脚本(chere
包的一部分)执行以下步骤:
- 向登录 shell 指示不要
cd $HOME
(export CHERE_INVOKING=true
在 中检查/etc/profile
);
- 更改为作为第二个参数 ( ) 传递的目录
cd "$2"
;
- 执行作为登录 shell (
exec -l $1
) 的第一个参数传递的 shell。
注意:如果替换/bin/bash
为/etc/passwd
,则使用当前用户读取的登录 shell/etc/passwd
而不是bash
.