linux 中xargs -i 和-I在使用上的区别
001、 -i
[root@PC1 test]# ls [root@PC1 test]# touch a.txt a.csv [root@PC1 test]# ls a.csv a.txt [root@PC1 test]# find ./ -name "*.txt" | xargs -i cp {} {}.bak ## -i单独传递参数 [root@PC1 test]# ls a.csv a.txt a.txt.bak
02、-I
[root@PC1 test]# ls [root@PC1 test]# touch a.txt a.csv [root@PC1 test]# ls a.csv a.txt [root@PC1 test]# find ./ -name "*.txt" | xargs -I cp {} {}.bak ## 报错 xargs: {}: No such file or directory [root@PC1 test]# ls a.csv a.txt
-I的正确用法:
[root@PC1 test]# ls [root@PC1 test]# touch a.txt a.csv [root@PC1 test]# ls a.csv a.txt [root@PC1 test]# find ./ -name "*.txt" | xargs -I {} cp {} {}.bak ## 正确用法 [root@PC1 test]# ls a.csv a.txt a.txt.bak
分类:
linux shell
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
2022-05-08 R语言中实现第一列转化为行名、第一行转化为列名
2022-05-08 R语言中利用readxl包读取excel数据
2022-05-08 R语言中获取变量占据内存的大小object.size函数
2022-05-08 R语言实现数据的标准化
2022-05-08 R语言中scale函数的用法
2022-05-08 数据的中心化、标准化
2022-05-08 R语言中批量加载包