Reputation: 13
feh <(cat img.jpg);
The above command doesn't work with the error feh: No loadable images specified.
.
cat img.jpg | feh -;
feh < <(cat img.jpg);
The above commands work fine.
echo <(cat img.jpg);
simply shows /dev/fd/63
. I don't know why feh
doesn't open /dev/fd/63
. Plz help.
Upvotes: 1
Views: 112
Reputation: 123470
You're doing it correctly, but feh
has a bug/feature that makes it fail.
If you look at the source code, you can see how this happened. In pseudo-code with a lot of details excluded, it goes like this:
void add_file_to_filelist_recursively(path, is_first_level) {
if (is_first_level) {
if(path_is_url(path)) {
// Download
} else if(path == "-") {
// Read STDIN
}
}
if(is_directory(path)) {
for(file in path) {
add_file_to_filelist_recursively(file, false);
}
} else if(is_regular_file(path)) {
add(path);
}
}
It's a simple function for recursively looking for files, and it also handles URLs and -
specially when directly specified on the command line (and not when they appear as filenames)
While recursing, it will add regular files, and it will descend into directories. Anything else will be skipped. This is presumably because it rarely makes sense to try to read sockets, devices and fifos. However, as a side effect, it will also ignore your /dev/fd/63
since it's a fifo.
One might argue that feh
should try to read whatever the user explicitly specifies, and that would be a simple fix. However, as it is, there's no way to make it work with Bash's process substitution directly.
Upvotes: 3