【发布时间】:2020-10-04 22:28:06
【问题描述】:
我有这个可以工作的 bash 脚本(它打印输出),但是当我运行程序时,最后出现错误 /bin/sh not found,makefile 错误 127。我什至没有 bin/嘘,我写了 bin/bash。 analisi.sh是脚本,这是makefile的一部分,supermercato.PID是保存线程supermercato的PID的地方。
./run:
cd src; \
(./supermercato & echo $$! > supermercato.PID) & \
cd ..; \
sleep 25s; \
kill -1 $$(cat src/supermercato.PID); \
chmod +x ./analisi.sh
./analisi.sh $$(cat src/supermercato.PID); \
这是脚本analisi.sh,test.log是写入输出的文件
#!/bin/bash
if [ -f "test.log" ]; then
while read line; do echo $line; done < test.log
else
echo "$0:Errore" 1>&2
fi
这是一个错误示例(SIGHUP 是项目的一部分)。 TEST 写在我从脚本中读取的名为 test.log 的日志文件中。
Received SIGHUP
./analisi.sh $(cat src/supermercato.PID); \
******TEST******
/bin/sh: 1: : not found
make: *** [Makefile:15: run] Error 127
【问题讨论】: