Bash variable assignment and command not found [duplicate]

Try this (notice I have removed the spaces from either side of the =):

#!/bin/bash
J="4"
FACE_NAME="eig$J.face"
USER_DB_NAME="base$J.user"

Bash doesn't like spaces when you declare variables - also it is best to make every value quoted (but this isn't as essential).


It's a good idea to use braces to separate the variable name when you are embedding a variable in other text:

#!/bin/bash
J=4
FACE_NAME="eig${J}.face"
USER_DB_NAME="base${J}.user"

The dot does the job here for you but if there was some other character there, it might be interpreted as part of the variable name.


dont' leave spaces between "="

J=4
FACE_NAME="eig${J}.face"
USER_DB_NAME="base${J}.user"