The commands that read
stdin are almost all of the filter family, i.e. programs that transform a flow of text data to a transformed one.
gzip and even
sh are good examples of such "filters".
The cited commands,
rm are definitely not filters but commands that do things with the arguments passed, here files or directories.
cd command is similar to them, it expects an argument (or simulate a default one if not provided), and generally doesn't output anything on
stdout, although it might output something on it in some cases like when using
Even if one want to create a
cd variant that take the target directory from stdin, it wouldn't have any effect when used in a pipeline in the Bourne shell,
bash to name a few. The last component of the command being run in a subshell, the change to a new directory won't affect the current shell. e.g.:
echo /tmp | cd would work with
ksh93 but not
cd <(echo /tmp) would work with shells supporting process substitution (at least
zsh) but wouldn't have any significant advantage compared to
cd $(echo tmp)
The only use case that might be of interest would be something like:
echo tmp | (cd ; pwd)
Finally, such a variant would need to sort out the case it was given no argument but the expected behavior is to change the directory to the users's home or it was given no argument but the expected behavior is to read the name of the target directory from stdin. As there is no reliable way to decide, this is doomed.