msysgit sh.exe 参数

12

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

例如,我知道使用--login标志启动git bash会话,但我想了解其他可能性。

我已经在互联网上搜索过,但没有找到列出所有可能参数的地方。

2个回答

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网站Bash手册


非常感谢 @poke。不明白我怎么会错过这个 :) - Kevin MOLCARD

4
来自 git 命令行工具套件 https://git-scm.com/download/winsh.exe 是一个 Windows 可执行文件,但可以执行 Linux 命令行和 Linux shell 脚本。
  • Firstly the path should be set, for example: set PATH=D:\Programs\Gitcmd\bin;%PATH%
  • Maybe some environment variables are proper to build a $HOME: HOMEDRIVE and HOMEPATH.
  • both can be done proper in a batch file.

    sh.exe 
    

    without arguments opens a shell window, try to type commands like 'ls', 'whoami' or 'git'. It should run.

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

    invokes a single linux command, for example sh.exe -x -c "git status"

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

    executes that scriptfile.

您可以在http://www.vishia.org/Git/html/Gitcmd.html中阅读更多相关编程内容。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接