msysgit sh.exe参数

时间:2012-11-05 09:55:22

标签: git batch-file sh msysgit

我正在尝试查找有关msysgit sh.exe命令的一些文档。

例如,我知道启动git bash会话的--login标志,但我知道其他可能性。

我查看了互联网,但找不到列出所有可能参数的地方。

2 个答案:

答案 0 :(得分:14)

> .\sh.exe --help
GNU bash, version 3.1.0(1)-release-(i686-pc-msys)
Usage:  ".../Git/bin/sh.exe" [GNU long option] [option] ...
        ".../Git/bin/sh.exe" [GNU long option] [option] script-file ...
GNU long options:
        --debug
        --debugger
        --dump-po-strings
        --dump-strings
        --help
        --init-file
        --login
        --noediting
        --noprofile
        --norc
        --posix
        --protected
        --rcfile
        --restricted
        --verbose
        --version
        --wordexp
Shell options:
        -irsD or -c command or -O shopt_option          (invocation only)
        -abefhkmnptuvxBCHP or -o option
Type `".../Git/bin/sh.exe" -c "help set"' for more information about shell options.
Type `".../Git/bin/sh.exe" -c help' for more information about shell builtin commands.
Use the `bashbug' command to report bugs.

另请参阅GNU websitebash’s manual

答案 1 :(得分:4)

git命令行工具套件https://git-scm.com/download/win中的sh.exe 本身就是Windows可执行文件,但可以执行linux命令行和linux shell脚本。

  • 首先应设置路径,例如:set PATH=D:\Programs\Gitcmd\bin;%PATH%
  • 也许有些环境变量适合构建$HOME:HOMEDRIVE和HOMEPATH。
  • 两者都可以在批处理文件中正确完成。

    sh.exe 
    

    不带参数打开一个shell窗口,尝试输入'ls','whoami'或'git'等命令。它应该运行。

    sh.exe -x -c "command arg1 'arg2 with spaces' arg3" 
    

    调用单个linux命令,例如sh.exe -x -c "git status"

    sh.exe -x "path/to/scriptfile"
    

    执行该脚本文件。

您可以在http://www.vishia.org/Git/html/Gitcmd.html

中阅读更多内容