I have a bash script. It has a loop within, which builds a file-name.
I want to keep a list of file-names that are created. It seems like it takes the file-name as something to execute, rather than as text. I get xxx: command not found error on each append and command that is not found is the file name I want to append.

Any ideas why?

  • 3
    Please edit your question to include the relevant lines of your script. – steeldriver Jan 10 '17 at 20:42
  • 1
    Please edit question, to show what you did, and what the result was. From what you have told us, we can tell you “something went wrong somewhere”. – ctrl-alt-delor Jan 10 '17 at 22:07
  • consider using an array for this purpose, instead – Jeff Schaller Jan 11 '17 at 1:55

If your code does something like this in the loop:


the error message makes me think you've got whitespace (space or tab characters) by the '=' character. That is, do this:


Don't do this:

  • It is tradition for only environment variables to be capitals. – ctrl-alt-delor Jan 10 '17 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.