msysgit sh.exe arguments

依然范特西╮ 提交于 2019-12-05 15:02:33

问题


I am trying to find some documentation about msysgit sh.exe command.

For instance I am aware of the --login flag to launch a git bash session but I would to know the other possibilities.

I have looked over the internet but can not find any place where is listed all the possibles arguments.


回答1:


> .\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.

See also the GNU website, and bash’s manual.




回答2:


The sh.exe from the git command line tool suite https://git-scm.com/download/win is a Windows executable by itself but can execute linux command lines and linux shell scripts.

  • 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.

You can read more in http://www.vishia.org/Git/html/Gitcmd.html



来源:https://stackoverflow.com/questions/13229642/msysgit-sh-exe-arguments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!