Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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

Your Answer

 
discard

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.