Shell - for loop

2022-04-12 11:14PM
[/home/zzh/aaa]$>lh
total 8.0K
-rw-rw-r-- 1 zzh users    0 Apr 12 05:08 c.txt
-rw-rw-r-- 1 zzh users    0 Apr 12 05:08 b.txt
-rw-rw-r-- 1 zzh users    0 Apr 12 05:08 a.txt

2022-04-12 11:14PM
[/home/zzh/aaa]$>for x in *.txt; do
>> mv $x $x.bak
>> done

2022-04-12 11:16PM
[/home/zzh/aaa]$>lh
total 8.0K
-rw-rw-r-- 1 zzh users    0 Apr 12 05:08 c.txt.bak
-rw-rw-r-- 1 zzh users    0 Apr 12 05:08 b.txt.bak
-rw-rw-r-- 1 zzh users    0 Apr 12 05:08 a.txt.bak

 

相关文章

Centos系统之Shell编程基础知识
从Export理解Shell环境和变量生存期
linux shell数组变量、类型及规则
Centos编程Shell基本工作原理方案
Centos操作系统编程之Shell 问答录
rsync-linux备份脚本