我在bash脚本中有一个函数,该函数正在执行以下操作:
get_repo_master_hash() {
timeout 60 bash -c "git ls-remote $REPOURL | grep refs/heads/master | cut -f 1"
}
但是在我的脚本中执行此操作后,我收到以下消息:
timeout: can't execute '60': No such file or directory
为什么执行持续时间而不是我的命令?
此脚本正在使用alpine / git:1.0.4作为映像的docker容器中执行。
答案 0 :(得分:1)
在Docker alpine:3.6
容器上,我得到了
$timeout --help
Usage: timeout [-t SECS] [-s SIG] PROG ARGS
因此,您应该改为使用timeout -t 60
。