msysgit sh.exe arguments

13,809

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

Solution 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

Share:
13,809
Kevin MOLCARD
Author by

Kevin MOLCARD

Updated on June 01, 2022

Comments

  • Kevin MOLCARD
    Kevin MOLCARD almost 2 years

    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.