Linux命令将一个文件复制到多个文件 [英] Linux commands to copy one file to many files

查看:733
本文介绍了Linux命令将一个文件复制到多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux上是否可以使用单行命令/脚本将一个文件复制到多个文件?

Is there a one-line command/script to copy one file to many files on Linux?

cp file1 file2 file3

将前两个文件复制到第三个文件中.有没有办法将第一个文件复制到其余文件中?

copies the first two files into the third. Is there a way to copy the first file into the rest?

推荐答案

cp file1 file2 ; cp file1 file3

算作单行命令/脚本"吗?怎么样

count as a "one-line command/script"? How about

for file in file2 file3 ; do cp file1 "$file" ; done

?

或者,对于复制"的理解稍微宽松一些:

Or, for a slightly looser sense of "copy":

tee <file1 file2 file3 >/dev/null

这篇关于Linux命令将一个文件复制到多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆