bash - Git-Bash 运行命令的快捷方式

标签 bash shell git-bash

我当前的快捷方式具有以下目标:C:\Development\Git\git-bash.exe

我如何让它执行更复杂的操作,例如:

C:\Development\Git\git-bash.exe **ls**

C:\Development\Git\git-bash.exe **java -jar myfile.war**

最佳答案

您可以修改快捷方式:

 bash.exe --init-file <(echo "ls; pwd")

如果你想要 git-bash,并且为了避免 git-bash 在执行这些命令后立即打开和关闭 Windows,你将执行(或修改快捷方式):

C:\Development\Git\git-bash.exe -c "ls; $SHELL"

这样,shell 在执行完您想要的第一个命令后仍保留在原位。


Baker 中所述的 comment

In Windows 10/11 the shortcut target is particular about quotes.
This format seems to work:

"C:\Program Files\Git\git-bash.exe" -c "emulator -avd Pixel3a -writable-system; $SHELL"

关于bash - Git-Bash 运行命令的快捷方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42849378/

相关文章:

linux - 获取文件名及其 md5sums 的组合列表

linux - 在 linux 中使用 shell 脚本从单词中读取特定字符

python - 在heroku中部署一些更改时无法编译python(权限被拒绝!)

windows - 如何使用 bash 命令在 Windows 10 中创建和激活虚拟环境

linux - Bash 脚本 : Syntax error in conditional expression

bash - 虽然文件不包含字符串 BASH

linux - bash 如何知道从/usr/lib/git-core/读取自动补全

windows - Git bash 不断自动滚动到窗口底部

regex - 验证字符串是否仅包含 ASCII 字符和数字

shell - shell 错误: redirection unexpected in using bc