目标:

# cp -v /users/a/b/file.sh /users/a/test
# cp -v /users/a/b/file.sh /users/a/tmp

可以用 cp 命令与 echo命令、管道、xargs 命令一起使用:

# echo /users/a/test/ /users/a/tmp | xargs -n 1 cp -v /users/a/b/file.sh
1.-n 1 - 告诉 xargs 命令每个命令行最多使用一个参数,并发送到 cp 命令中。
2.cp – 用于复制文件。
3.-v– 启用详细模式来显示更多复制细节。

试试阅读 cp、 echo 和 xargs 的 man 页面来找出所有有用和高级的用法信息:

$ man cp
$ man echo
$ man xargs

 

相关文章:

  • 2022-01-16
  • 2022-02-13
  • 2022-12-23
  • 2021-06-06
  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-14
  • 2021-11-05
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2021-08-05
  • 2021-07-10
相关资源
相似解决方案