我编写了这段代码,以便在我的Linux远程机器上执行,以便使用不同的输入进行一些重复的实验。
#!/bin/bash
#timeout 10m
trap "exit 1" INT
repeat() {
executiontime=$( /usr/bin/time /home/me/optimathsat-1.5.1-macos-64-bit/bin/optimathsat < file.smt2 2>&1 >/dev/null)
echo "$executiontime">>results.csv
}
export -f repeat
for length in 30 ; do
step=0.05
short=0 #0
long=1
for i in {1..10}; do
ratio=0
for j in {1..10}; do
declare -a listofresults
echo "$length $short $long $ratio">>results.csv
python3 main.py "$length" "$short" "$long" "$ratio">file.smt2
chmod 775 file.smt2
declare total=0
declare m=0
parallel -n0 repeat ::: {1..10}
ratio=$(echo "scale=10; ($ratio) + ($step)" | bc)
done
short=$(echo "scale=10; ($short) + ($step)" | bc)
long=$(echo "scale=10; ($long) - ($step)" | bc)
done
done
trap - INT我已经在我自己的mac机器上执行了这段代码,并且它工作正常(使用gtime而不是/usr/bin/time ),但是现在我得到了这个错误,我不知道它是什么意思/
0inputs+0outputs (0major+66minor)pagefaults 0swaps
/home/me/optimathsat-1.5.1-macos-64-bit/bin/optimathsat: 1: /home/project/optimathsat-1.5.1-macos-64-bit/bin/optimathsat:
Syntax error: word unexpected (expecting ")")当我尝试手动执行这些指令时,我得到的结果是:
src$ python3 main.py 10 0.5 0.5 0.5>file.smt2我检查了file.smt2,它应该是这样的,然后就会发生这种情况
src$ /home/project/optimathsat-1.5.1-macos-64-bit/bin/optimathsat < file.smt2
-bash: /home/project/optimathsat-1.5.1-macos-64-bit/bin/optimathsat: cannot execute binary file: Exec format error发布于 2019-11-17 01:26:55
$ bash -x myscript.sh进行调试开始。它将显示导致错误的行。看The Linux Documentation Project's guide.echo "Hello" > foo; cat Foo,但不能在Linux上运行。希望这能有所帮助!
https://stackoverflow.com/questions/58892753
复制相似问题