[Bash] Curly braces tips
For example I want to override and rename file.txt_
with file.txt
mv file.txt{_,}
You can also check the full command with echo
echo mv file.txt{_,}
# > mv file.txt_ file.txt
Another example: if you want to cat
beep.txt
and boop.txt
file, instead of doing cat beep.txt boop.txt
, you can do cat b{ee,oo}p.txt
.
Using {} for loop over items in collection
echo {a,b}{c,d}
# > ac ad bc bd
generate senquence string
echo img{0..10}.png
# > img0.png img1.png img2.png img3.png img4.png img5.png img6.png img7.png img8.png img9.png img10.png
You can give step
as well
echo img{0..100..10}.png
# > img0.png img10.png img20.png img30.png img40.png img50.png img60.png img70.png img80.png img90.png img100.png
Example of generate directory:
mkdir -p images/img{0..10..10}.png
分类:
CLI
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2023-05-15 [Rust] Collect()
2019-05-15 [Functional Programming] Week logic
2018-05-15 [Javascript] Getter and Setter Abstractions
2017-05-15 [Recompose] Flatten a Prop using Recompose
2017-05-15 [Recompose] Lock Props using Recompose -- withProps
2017-05-15 [Recompose] Transform Props using Recompose --mapProps
2017-05-15 [Recompose] Add Lifecycle Hooks to a Functional Stateless Component using Recompose