I decided to read a book about Linux/Unix. I've reached a chapter where they try to explain how to pass the output of commands as expansions to the shell.
The following command
file $(ls /usr/bin/* | grep zip)
gives me the error "cannot open "file name (No such file or directory)". On the contrary, when I do
file $(ls | grep zip)
everything appears normally, no matter the folder. Why? Is it some kind of argument restriction?
If I do this
file $(ls Pictures/ | grep jpg)
I get the following:
1234.jpg: ERROR: cannot open 1234.jpg (No such file or directory)
while moving right in the directory that I want to list
nassosdim@ubuntu:~$ cd Pictures/
nassosdim@ubuntu:~/Pictures$ file $(ls | grep jpg)
prints out the result of file
1234.jpg: JPEG image data, JFIF standard 1.01
Can someone explain to me what's going on? :(