简体   繁体   中英

Command not found (Linux terminal) Path settings

I am working on a cache simulator and while execution i am getting the following error . I am using Ubuntu terminal for executing the program. I don't understand the problem with error since i have all the additional files mapped to the main program.

do i need to set path for the program to any directory to execute them?

At first for giving permissions i executed the following command so that i wont get "permission error"

enter code here
chmodx +x ./csim.c

And then i executed the following command for final program execution

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

errors in output terminal

./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

how can i fix this ?

You are attempting to execute a C source code file, which the shell is interpreting as a shell script because you have given it the "executable" mode.

The first thing to do is to compile the C file, eg

cc csim.c -o csim

... and then run the resulting executable program.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM