0

Essentially, I have a file containing the path to another file. A single line looks like this.

"/home/self/file"

Now, separately...

> cat "/home/self/file"
blah blah
...

> grep '".*"' /path/to/containing/file
"/home/self/file"

> cat $(grep '".*"' /path/to/containing/file)
cat: "/home/self/file": No such file or directory

The results are weird. How do I circumvent this?

1 Answer 1

0

It's because of the double quotes.

If possible modify the path/to/containing/file and remove the quotes. If not possible add a piped process (tr or sed or something similar) to remove the quotes from the process substitution.

2
  • Ah, yeah, that's it. Any idea why that is? cat doesn't seem to mind quotes ordinarily.
    – user34900
    Mar 25, 2013 at 12:26
  • In your first command, the quotes are processed by the shell before being sent to cat, quotes are simply never part of the file name. Don't forget to mark the answer as accepted if it solves your issue.
    – rahmu
    Mar 25, 2013 at 12:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .