You're viewing a comment by Vishal and its responses.

Vishal Permalink
June 20, 2012, 13:12

Why < < is required in:
read -r line < <(head -1 InstId.txt)
where as not in:
diff -q <(sort InstId.txt | uniq) <(sort secId.txt | uniq)
or not in,
comm -12 <(sort InstId.txt | uniq) <(sort secId.txt | uniq)

Comment Responses

peteches Permalink
June 21, 2012, 11:46

Hi Vishal

When you use the <( cmd ) construct bash replaces the <( cmd ) with the path to the fd of cmd's stdout. eg

[0]pete.uttley@jackfrog::1901$ echo <(cat /tmp/frog-uuid-patch )

as diff takes file paths as arguments it can handle this with no problem. It doesn't take them as stdin.

Read expects stdin to assign to it's variable so you need to redirect the contents of the file descriptor, hence the need to redirect the contents of the file handle.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "floppy_325": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.