有人可以用下面的代码解决我的头痛。我想编写一个 bash 脚本,它将根据用户输入的信息和显示表创建一个包含时间间隔的表。这是另一个程序的一部分,但我得到了这个until command
应该很容易使用的堆栈。对不起!我正在用法语编码,但这个想法就像我解释的那样
#!/bin/bash
read -p "entrez l'heure de depart(exple: hh:mn:06 or hh:mn:36):" beg_time
read -p "entrez l'intervalle de temps en minute(exple: 10):" Inter
read -p "entrez le nombre d'occurence(exple: 4):" Nbre
let "i = 1"
let "Nb = $Nbre"
tab=("$beg_time")
until [ "$i" -eq "$Nb" ]
do
tab["$i"]=`date -j -v '+"$Inter"M' -f "%H:%M:%S" "$beg_time" "+%T"`
let "i += 1"
done
echo ${tab[*]}
但我得到这个错误
line 8: until [ 1: command not found
我需要提到我使用的是 MacOS,所以 date 命令可能无法在其他 linux 操作系统上运行。请帮忙