this post was submitted on 20 Dec 2025
26 points (100.0% liked)

Linux

11002 readers
621 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS
 

I was trying to find all symbolic links in /usr/lib and use file on the first entry in the list, which I delimited with head -n 1.

Why does find /usr/lib -maxdepth 1 -type l | file $(head -n 1) work but find /usr/lib -maxdepth 1 -type l | head -n 1 | file does not?

It complains that I am not using file correctly. Probably because it lacks an argument, but - programmatically/syntactically - why can't file grab it's argument from the pipe?

you are viewing a single comment's thread
view the rest of the comments
[–] N0x0n@lemmy.ml 6 points 3 weeks ago (1 children)

I learned this the hardway with ffmpeg... In my defense... Their documentation IS huge !!!

Kinda interested if 2>&1 would also work in this case?

[–] theit8514@lemmy.world 11 points 3 weeks ago (1 children)

2>&1 pipes stderr to stdout, which would not affect a binary like file which doesn't parse stdin. You would need something like xargs file which would convert the stdout to command line arguments.

[–] N0x0n@lemmy.ml 2 points 2 weeks ago

Thanks for the clarification :)) still new the all the bash syntax and always interested to hear what more skilled people have to say !