tcl:执行 git 命令
tcl : execute git command
我想下载我的 git repo unsing tcl。
我用这个程序
proc download_git_repo {} {
global git_rev git_path
exec git clone https://github.com/bitcoin/bitcoin.git $git_path/bit_git
}
但我找不到目录 bit_git,似乎命令 exec 不能与 git 一起正常工作!
我对其他命令使用了 exec,它工作正常
如何使用 tcl
在 shell 中执行 git 命令
最有可能的选择是您不在您认为的目录中。当您编写脚本时,很容易出错;例如,直接从 GUI 调用的程序往往 运行 在与您期望的完全不同的位置。
我建议将您要传递给 git clone
的值写入变量,然后将其记录在某处:
proc download_git_repo {} {
global git_rev git_path
set theLocation $git_path/bit_git
puts "working dir: [pwd]\nlocation: $the_location"
# Use this instead if inside a Tk script:
# tk_messageBox -message "working dir: [pwd]\nlocation: $the_location"
exec git clone https://github.com/bitcoin/bitcoin.git $the_location
}
这样,您就可以清楚地看到您真正为 git 付出了什么。我建议确保它是一条绝对路径;那些不惊喜。
虽然 Tcl 非常小心地正确处理文件名中的空格之类的事情(除非你 eval
;不要那样做!)但其他工具并不总是如此小心。
我想下载我的 git repo unsing tcl。 我用这个程序
proc download_git_repo {} {
global git_rev git_path
exec git clone https://github.com/bitcoin/bitcoin.git $git_path/bit_git
}
但我找不到目录 bit_git,似乎命令 exec 不能与 git 一起正常工作!
我对其他命令使用了 exec,它工作正常
如何使用 tcl
在 shell 中执行 git 命令最有可能的选择是您不在您认为的目录中。当您编写脚本时,很容易出错;例如,直接从 GUI 调用的程序往往 运行 在与您期望的完全不同的位置。
我建议将您要传递给 git clone
的值写入变量,然后将其记录在某处:
proc download_git_repo {} {
global git_rev git_path
set theLocation $git_path/bit_git
puts "working dir: [pwd]\nlocation: $the_location"
# Use this instead if inside a Tk script:
# tk_messageBox -message "working dir: [pwd]\nlocation: $the_location"
exec git clone https://github.com/bitcoin/bitcoin.git $the_location
}
这样,您就可以清楚地看到您真正为 git 付出了什么。我建议确保它是一条绝对路径;那些不惊喜。
虽然 Tcl 非常小心地正确处理文件名中的空格之类的事情(除非你 eval
;不要那样做!)但其他工具并不总是如此小心。