Discussion Locked

Diff btw Command Substitution And Pipeli

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Newbie question:
I'm puzzled at this pt of learning: What's the difference btw the usage of comm. substituion (`) and pipelines (|) ?
I mean HOW do you determine which one to use
to feed Inputs ? They are NOT interchangeale under any circumstanceat all, are they ?
Pls be as specific as u can..I'm pretty new to this. Thanks

3 replies

by cavedweller

Command output substitiution is used to place a calculated value into the current command. Piping is used to feed the output of a command into another command (as input to the second command).

For instance, echo "The current directory is "`pwd` would cause the result of the pwd command to be printed at the end of the output line. The command "find . -depth -print | cpio -ocv -Osaveset.cpio" generates a list of filenames (with find) and pipes the list into cpio which saves the files.

This discussion is closed to new replies.