Skip to main content
edited tags
Link
Gilles 'SO- stop being evil'
  • 866.1k
  • 205
  • 1.8k
  • 2.3k
Tweeted twitter.com/#!/StackUnix/status/157514022667821056
edited tags
Link
user13742
user13742
added 8 characters in body
Source Link
Mat
  • 54.9k
  • 11
  • 164
  • 143

First iI write a configfile with all my parameters like this

path="/home/test/"

I name it testtest.conf.conf

Then iI write a shell script with this content and, name it testtest, and make it executable with chmod +xchmod +x.

#!/bin/bash
#read the config file
. /home/test/test.conf

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

And I get this output

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

But whatWhat I wantwould like is that it shows me the content of the file /home/test/test/home/test/test. So how

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

First i write a configfile with all my parameters like this

path="/home/test/"

I name it test.conf

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

#!/bin/bash
#read the config file
. /home/test/test.conf

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

And I get this output

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

But what I want is that it shows me the content of the file /home/test/test. So how do I write this script correctly, that it doesn't make a new line after the filepath?

First I write a configfile with all my parameters like this

path="/home/test/"

I name it test.conf.

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

#!/bin/bash
#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?

Source Link
persec
  • 53
  • 1
  • 1
  • 3
Loading