0

I am encountering this weird message at the moment with my file. I have a very basic C file that reads from a file and outputs upon request. I am running the following command in Linux:

filename <filenametest.txt >filenameoutput

and it brings the following message:

filename: command not found

Any idea why it's not working? Really frustrating.

4
  • Yes, 'filename' is the compiled file of 'filename.c'. I run "gcc -o filename filename.c". Commented Oct 15, 2015 at 23:16
  • It would be a security disaster if this worked! Imagine if I know someone who frequently types lss instead of ls. I could simply create an executable called lss that deletes all his files and induce him to change into the directory in which that executable lives. One typo on his part and boom. Commented Oct 15, 2015 at 23:22
  • Which part didn't you understand? Commented Oct 15, 2015 at 23:27
  • 1
    @DavidSchwartz the part that windows' standard behavior is a disaster :D Commented Oct 15, 2015 at 23:29

1 Answer 1

2

Assuming that filename is the name of the executable generated on compiling your C code, maybe you should try using

./filename < filename.txt > filenameoutput.

Since filename is not in the search path by default.

Sign up to request clarification or add additional context in comments.

9 Comments

"Since filename is not a built-in." No, it's just not in your search path. Note you're just guessing here, this question in its current state cannot really be answered...
In that case @dj31 must first compile his C code. I'm sorry, I just made an assumption here. Kind of new here, do I need to remove my answer since the question really isn't specific enough?
@ThePentium I wouldn't remove it right now, just correct the last sentence (in general, unix systems don't have "." / the current working directory in the search path by default). It might very well be the correct answer. Nevertheless, it's normally better to post an answer when you can be sure about it (and, gaining just a bit of reputation, you can request clarification in a comment to the question)
filename is the executable of of filename.c in my case.
another reason not to answer poorly asked questions like this ... you get to explain every stupid . :D
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.