gpt4 book ai didi

bash - 超时执行持续时间而不是命令

转载 作者:行者123 更新时间:2023-12-02 19:30:09 29 4
gpt4 key购买 nike

我在执行以下命令的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容器中执行。

最佳答案

在Docker alpine:3.6容器上我得到了

$timeout --help
Usage: timeout [-t SECS] [-s SIG] PROG ARGS

因此,您应该改为 timeout -t 60

关于bash - 超时执行持续时间而不是命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52186152/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com