[Cialug] shell escaping with command substitution?

Kenneth Younger kyounger at gmail.com
Mon Feb 9 21:41:14 CST 2015


Alright, a basics question, because apparently my shell-fu isn't strong
enough to figure this out:

I have a command I wrote, testpgm. When ./testpgm is run it outputs this:

'/Users/kenny/test/test 3.txt' '/Users/kenny/test/test1.txt'
'/Users/kenny/test/test2.txt'

When I then run cat $(./testpgm), I get errors. If I copy and paste the
output instead of doing command substitution, it works fine. What gives?
This is the error:

cat: '/Users/kenny/test/test: No such file or directory
cat: 3.txt': No such file or directory
cat: '/Users/kenny/test/test1.txt': No such file or directory
cat: '/Users/kenny/test/test2.txt': No such file or directory

It almost seems like it's double-escaping the output of testpgm.

Thanks in advance for any insights.

-Kenny

-- 
Kenneth Younger III
Founder, Sheer Focus Inc.
e: kenny at sheerfocus.com
p: (515) 367-0001
t: @kenny <http://twitter.com/kenny>


More information about the Cialug mailing list