I have been struggling with this issue for a while now and would really appreciate it if someone could clarify it for me . Suppose I am trying to pipe the two commands together. readlink
and cat
readlink Command output
$ readlink -f SUService.log
/cygdrive/c/SUService.log
Now if I try something like this (it fails)
$ readlink -f SUService.log | cat
While something like this will work
$ readlink -f SUService.log | xargs cat
I wanted to know why that is ? I have read this post here in which the OP had a similar question
and this post which attempts to explain difference between an argument and an input however i still couldnt wrap my head around the accepted answer(s). From what I understand is that readlink
returns the result to stdout which is the terminal screen while cat
wants an input as argument. This in return prompts me to ask how do I know if the output of a command (such as locate or readlink) can work as an argument or not for the next command ? I have been doing more reading and it turns out i would like to know when I should be using the xarg command ?
stdout
can act as an arugment if the shell supports process substitution.