1

I suspect this has been answered before, but I don't know what this is called, so I can't really search for it.

How come this works :

$ grep H=p <(udevadm info /dev/ttyUSB0)
E: ID_PATH=pci-0000:00:1d.0-usb-0:1.5.2:1.0

But this doesn't ? :

$ sudo grep H=p <(udevadm info /dev/ttyUSB0)
grep: /dev/fd/63: No such file or directory

Nevermind the fact that sudo isn't necessary in this case, please.

2

The shell is replacing <(udevadm info /dev/ttyUSB0) with /dev/fd/63 (after dup'ing the read end of the pipe to fd 63) before running the command. However, sudo closes all file descriptors greater than 2 by default. You can change this by using sudo's --close-from flag, but there's a better way:

sudo bash -c 'grep H=p <(udevadm info /dev/ttyUSB0)'

1
  • Neat, thank you. Of course I'll have to practice with it to really learn/understand it in time !
    – robut
    Jan 25 '15 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.