msysgit sh.exe arguments

后端 未结 2 1262
北荒
北荒 2021-02-19 23:22

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

相关标签:
2条回答
  • 2021-02-20 00:01
    > .\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.

    0 讨论(0)
  • 2021-02-20 00:02

    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

    0 讨论(0)
提交回复
热议问题