#!/bin/bash cd build for test_file in ../demo/*.go; do base_name=$(basename "$test_file" .go) echo -e "\n========== 编译 $base_name ==========" if ! ./tjugo ../demo/$test_file; then echo "编译错误,按任意键继续..." read -n 1 -s fi if ! ld -m elf_i386 -o run.bin out.o print.o; then echo "链接错误,按任意键继续..." read -n 1 -s fi echo -e "\n========== 运行 $base_name ==========" if ! ./run.bin; then echo "运行错误,按任意键继续..." read -n 1 -s fi done