0
votes

Ok so I've been trying to run some things from the command line and I'm having a 'permission denied' problem and then when I 'sudo ./(file.c' I get a 'command not found'. It's weird because other .c files in the same directory work ok.

I've downloaded and installed Xcode and command line tools. Also, I have #include some other things that are also in the same directory.

When I echo $PATH I'm getting this output: /opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Thanks for any help that could be provided!

1
So you're on Mac not Linux? Why the Linux tag? Is the file really named with a parenthesis like (file.c? - John Zwinck
no sorry....it's just like file.c - Soluble Snake
The linux tag is also accidental - Soluble Snake
Please provide the exact command and the output of ls. - ryanpcmcquen

1 Answers

0
votes

You're running sudo ./file.c but file.c looks like the name of a source code file which would usually not be executable. Probably the problem you're having is that you're trying to run something which cannot be run. If you really want to force the computer to run it, you can do chmod +x file.c before trying to run it. But if it is indeed C source code, it won't do anything useful.