#!/bin/sh RM="rm -rf" function delete_all_dir() { for i in `ls` do if [ -d $i ];then $RM $i fi done } function delete_all_file() { for i in `ls` do if [ -f $i ];then $RM $i fi done } in f) delete_all_file ;; d) delete_all_dir ;; esac 用法: 删除文件夹 [
假设我们现在有两个文件 a.txt .b.txt a.txt 中的内容如下: a c 1 3 d 4 b.txt 中的内容如下: a b e 2 1 5 # Example 01 计算并集: [root@VM_81_181_centos ~]# sort -u a.txt b.txt 1 2 3 4 5 a b c d e [root@VM_81_181_centos ~]# # Exmaple 02 计算交集: [root@VM_81_181_centos ~]# grep -F -f a.t