Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

First I write a configfile with all my parameters like this


I name it test.conf.

Then I write a shell script with this content, name it test, and make it executable with chmod +x.

#read the config file
. /home/test/test.conf

#cat the file /home/test/test
cat `$path`test #This line is the problem

I get this output

./test/test: line 3: /home/test/: Is a directory
cat: test: No such file or directory

What I would like is that it shows me the content of the file /home/test/test.

How do I write this script correctly, so that it doesn't make a new line after the file path?

share|improve this question
You should use double quotes ("$path"), not backquotes. – enzotib Jan 12 '12 at 9:36
up vote 10 down vote accepted

`` and $() is used for command execution, not for substituting it for variable content. So bash tries to execute varaible meaning in `` and returns the error that it is a directory.

Just write cat ${path}test and it will work in the way you want.

For more information read about bash variables and command substitution.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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