bash loop

loop with seq

#!/bin/bash

for n in seq 1 3 100
do
echo $n
done

loop find mv

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash

for i in {1..14}
do
# echo $i
# echo 'map_'$i'*.png'

# find . -maxdepth 1 -regex '.*map_'$i'.*'


# find . -name 'map_'$i'*.png'

echo map_$i-*.png
mv map_$i-*.png 222

done

ls only folder

ls -d */

/ is a pattern that matches all of the subdirectories in the current directory ( would match all files and subdirectories; the / restricts it to directories). Similarly, to list all subdirectories under /home/alice/Documents, use ls -d /home/alice/Documents/*/

查找系统中所有文件长度为0的普通文件,并列出它们的完整路径

find / -type f -size 0 -exec ls -l {} \;

###

vi .bash_profile

alias lf=”ls -l | egrep -v ‘^d’”
alias ldir=’ls -d */‘

lf 只显示文件
ldir 只显示目录