未找到命令(Linux终端)路径设置



我正在一个缓存模拟器上工作,在执行时我得到了以下错误。我正在使用Ubuntu终端来执行程序。我不理解错误的问题,因为我已经将所有附加文件映射到主程序。

我需要为程序设置到任何目录的路径来执行它们吗?

起初,为了给权限,我执行了以下命令,这样我就不会得到"权限错误"

enter code here
chmodx +x ./csim.c

然后我执行了下面的命令来执行最后的程序

enter code here
./csim.c [-hv] -s 5 -E 1 -b 5 -t traces/long.trace

输出端错误

./csim.c: line 1: /bin: Is a directory
./csim.c: line 2: cachelab.c: command not found
./csim.c: line 3: cachelab.c: command not found
./csim.c: line 4: cachelab.c: command not found
./csim.c: line 5: cachelab.c: command not found
./csim.c: line 6: cachelab.c: command not found
./csim.c: line 7: cachelab.c: command not found
./csim.c: line 8: cachelab.c: command not found
./csim.c: line 9: cachelab.c: command not found
./csim.c: line 10: cachelab.c: command not found
./csim.c: line 11: traces/: Is a directory

我该怎么解决这个问题?

您正试图执行一个C源代码文件,shell将其解释为shell脚本,因为您为其提供了"可执行"模式。

要做的第一件事是编译C文件,例如

cc csim.c -o csim

然后运行得到的可执行程序。

./csim [-hv] -s 5 -E 1 -b 5 -t traces/long.trace

最新更新