linux - 如何将 Linux which 命令的输出通过管道传输到 Linux 文件命令中?

标签 linux file command pipe

$ which file
/usr/bin/file
$ file /usr/bin/file
/usr/bin/file: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped

为什么这不起作用?

$ which file | file

Usage: file [-bcikLhnNrsvz0] [-e test] [-f namefile] [-F separator] [-m magicfiles] file...
   file -C -m magicfiles

尝试 file --help 获取更多信息。

最佳答案

您可能正在寻找 xargs 或 shell 扩展。尝试:

$ which file | xargs file

$ file `which file`

关于linux - 如何将 Linux which 命令的输出通过管道传输到 Linux 文件命令中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5017373/

相关文章:

php - nginx - 未指定输入文件。 Laravel 应用程序

python - 采购 Anaconda 激活脚本与将 Anaconda bin 目录添加到 PATH

c - 当在同一文件中定义其调用函数时如何在 C 中模拟函数?

c++ - QListview, QTreeview 是正确的以列表方式显示文件

batch-file - 批量命令双扩展修复

linux - 逐行读入文件并在另一个文件中搜索部分匹配的行

file - 符号链接(symbolic link)-复制目录层次结构

java - 如何用Java加密和解密声音文件?

function - 如何在 vim 函数中执行普通模式命令?

bash - Unix bash 错误 - 需要二进制运算符