Take the 2-minute tour ×

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


Now, separately...

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

> grep '".*"' /path/to/containing/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?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
Ah, yeah, that's it. Any idea why that is? cat doesn't seem to mind quotes ordinarily. –  user34900 Mar 25 '13 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 '13 at 12:45
add comment

Your Answer


