rm -rf . | wildcards | m5sum loop

rf -rf .  - will remove everything from the current directory downward
rf "-rf ." - will remove file named -rf .

ubuntu2@ubuntu2:~/temp/newdir1/dir2/dir3$ ll
total 8
drwxrwxr-x 2 ubuntu2 ubuntu2 4096 Jul 20 11:06 ./
drwxrwxr-x 3 ubuntu2 ubuntu2 4096 Jul 20 11:00 ../
-rw-rw-r-- 1 ubuntu2 ubuntu2    0 Jul 20 11:05 file-1
-rw-rw-r-- 1 ubuntu2 ubuntu2    0 Jul 20 11:06 file-2
-rw-rw-r-- 1 ubuntu2 ubuntu2    0 Jul 20 11:06 file-3
ubuntu2@ubuntu2:~/temp/newdir1/dir2/dir3$


ubuntu2@ubuntu2:~/temp/newdir1/dir2/dir3$ ll *[-12]
-rw-rw-r-- 1 ubuntu2 ubuntu2 0 Jul 20 11:05 file-1
-rw-rw-r-- 1 ubuntu2 ubuntu2 0 Jul 20 11:06 file-2
ubuntu2@ubuntu2:~/temp/newdir1/dir2/dir3$


to find - or [ put it into []
------------
touch *f*.dot
rm \*f\*.dot
------------
rm -rf *
ubuntu2@ubuntu2:~/temp/newdir1/dir2/dir3$ ll
total 8
drwxrwxr-x 2 ubuntu2 ubuntu2 4096 Jul 20 11:50 ./
drwxrwxr-x 3 ubuntu2 ubuntu2 4096 Jul 20 11:00 ../
-rw-rw-r-- 1 ubuntu2 ubuntu2    0 Jul 20 11:49 .test
------------


 ll
total 8
drwxrwxr-x 2 ubuntu2 ubuntu2 4096 Jul 20 11:51 ./
drwxrwxr-x 3 ubuntu2 ubuntu2 4096 Jul 20 11:00 ../
-rw-rw-r-- 1 ubuntu2 ubuntu2    0 Jul 20 11:51 file1
-rw-rw-r-- 1 ubuntu2 ubuntu2    0 Jul 20 11:51 file2
-rw-rw-r-- 1 ubuntu2 ubuntu2    0 Jul 20 11:51 file3
-rw-rw-r-- 1 ubuntu2 ubuntu2    0 Jul 20 11:49 .test
ubuntu2@ubuntu2:~/temp/newdir1/dir2/dir3$ set -o noglob
ubuntu2@ubuntu2:~/temp/newdir1/dir2/dir3$ rm *
rm: cannot remove ‘*’: No such file or directory
ubuntu2@ubuntu2:~/temp/newdir1/dir2/dir3$ ll



set +o noglob
ubuntu2@ubuntu2:~/temp/newdir1/dir2/dir3$ rm *
ubuntu2@ubuntu2:~/temp/newdir1/dir2/dir3$ ll
total 8
drwxrwxr-x 2 ubuntu2 ubuntu2 4096 Jul 20 11:52 ./
drwxrwxr-x 3 ubuntu2 ubuntu2 4096 Jul 20 11:00 ../
-rw-rw-r-- 1 ubuntu2 ubuntu2    0 Jul 20 11:49 .test
ubuntu2@ubuntu2:~/temp/newdir1/dir2/dir3$

------------

for filename in a* b*; do md5sum $filename; done
a45888e194263277c3609efd9ce69707  a1
7813db75db95e759afd971d5c92d5b7e  a2
ba4944388cdb14df5ff14b0e27303cb2  a3
5c8ed45495853061ab86e961bdbb0e48  a4

---------------------

Comments

Popular posts from this blog

HAproxy logging

teamcity Automatic Agent Start under Linux

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all