最简单的方法

 

shopt -s extglob             打开extglob模式
rm -fr !(file1)                 排除一个
rm -rf !(file1|file2|file3)  排除多个
shopt -u extglob             关闭extglob模式

 

相关文章:

  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-01
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案