在Windows 7 / 64bit中运行git bash脚本 [英] Run git bash script in Windows 7/64bit
问题描述
我试图在Windows 7,64位上运行git bash文件。该文件在下面。命令是:
git test-bash
输入命令后,暂停时间不会超过一秒,然后提示符返回。没有输出到终端并且没有创建文件。我做错了什么?
文件git-test-bash:
#!/ bin / bash
#start
printftest-bash-printf
echotest-bash-echo
echotest-bash-echo- to_file> /d/Users/joeuser/bin/file.txt
我只是在常规的DOS会话或shell会话中测试git-test-bash(调用 c:\prgs\git\PortableGit-2.5.1-64-bit\git -bash.exe
)。
它可以工作(除非你想添加' \\\
'为了将
printf
放在它自己的行中)
#!/ bin / bash
#start
printftest-bash-printf\\\
echotest-bash-echo
echotest -bash-echo-to_file> /C/Users/VonC/prog/file.txt
您只需确保%PATH%
(在DOS会话中)包含 git-test-bash
所在的文件夹。
输出:
C:\ Users \ vonc\prog\b2d> git test-bash
test-bash-printf
test-bash-echo
或者在bash shell会话中:
$ $ p $ $ code $ vonc @ bigvonc MINGW64〜/ prog / b2d(master)
$ git test- bash
test-bash-printf
test-bash-echo
试试看尽管最近的git-for-windows 。
我使用了最新的2.5.1。
I am trying to run a git bash file in Windows 7, 64-bit. The file is below. The command is:
git test-bash
When the command is entered, there is a pause of no more than a second, then the prompt returns. There is no output to the terminal and no file created. What am I doing wrong?
file git-test-bash:
#!/bin/bash
# start
printf "test-bash-printf"
echo "test-bash-echo"
echo "test-bash-echo-to_file" > /d/Users/joeuser/bin/file.txt
I just tested git-test-bash in a regular DOS session, or in a shell session (calling c:\prgs\git\PortableGit-2.5.1-64-bit\git-bash.exe
).
It does work (except you might want to add '\n
' in order to put the printf
in its own line)
#!/bin/bash
# start
printf "test-bash-printf\n"
echo "test-bash-echo"
echo "test-bash-echo-to_file" > /C/Users/VonC/prog/file.txt
You only have to make sure %PATH%
(meaning in DOS session) includes the folder where git-test-bash
is.
Output:
C:\Users\vonc\prog\b2d>git test-bash
test-bash-printf
test-bash-echo
Or in bash shell session:
vonc@bigvonc MINGW64 ~/prog/b2d (master)
$ git test-bash
test-bash-printf
test-bash-echo
Try it with a recent git-for-windows though.
I used the latest 2.5.1.
这篇关于在Windows 7 / 64bit中运行git bash脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!