git msysgit sh.exe 参数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13229642/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
msysgit sh.exe arguments
提问by Kevin MOLCARD
I am trying to find some documentation about msysgit sh.exe command.
我试图找到一些关于 msysgit sh.exe 命令的文档。
For instance I am aware of the --login
flag to launch a git bash session but I would to know the other possibilities.
例如,我知道--login
启动 git bash 会话的标志,但我想知道其他可能性。
I have looked over the internet but can not find any place where is listed all the possibles arguments.
我查看了互联网,但找不到任何列出所有可能参数的地方。
回答by poke
> .\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.
回答by Hartmut Schorrig
The sh.exe
from the git command line tool suite https://git-scm.com/download/winis a Windows executable by itself but can execute linux command lines and linux shell scripts.
在sh.exe
从git的命令行工具套件https://git-scm.com/download/win本身就是一个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.
- 首先应该设置路径,例如:
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"
执行该脚本文件。
You can read more in http://www.vishia.org/Git/html/Gitcmd.html