Problem scenario
If there are multiple files named "foobar", what would this Linux command do?
echo "ccc" > $(sudo find / -name foobar)
Here are your options:
a. Send "ccc" to be the content of the first file found.
b. Send "ccc" to be the content of the each file found.
c. Send "ccc" to be the content of the last file found.
d. Fail.
Which one do you think is correct?
Scroll down to see the answer.
Scroll down to see the answer.
Scroll down to see the answer.
Scroll down to see the answer.
Answer
D. Fail. The result of the above command if there were two files named "foobar" would be an error "ambiguous redirect". If you used echo $?, you would see a 1.