这对`cat`来说是无用的吗?

Jam*_*mie 3 bash

我不知道如何在不使用猫的情况下完成以下工作.我并不担心分叉过程或任何事情,它让我感到不安:

$ printf "<format specification string>" $(cat source-file.txt)
Run Code Online (Sandbox Code Playgroud)

有没有更好的办法?

Ada*_*iss 7

是.您无需创建新流程即可完成相同的操作cat:

$ printf "<format specification string>" $(<source-file.txt)
Run Code Online (Sandbox Code Playgroud)

  • OP*用**bash**标记了这个问题,但是请注意这是特定于bash的,并且在其他Posix shell中不起作用. (2认同)
  • @Charles对我来说听起来很有趣.如果我"按周期",我绝对不会*在bash中编写那个循环!大声笑 (2认同)