博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux 意外删除与恢复
阅读量:7208 次
发布时间:2019-06-29

本文共 1087 字,大约阅读时间需要 3 分钟。

vi rm.sh#! /bin/bash  ##linux删除huishou=~/.temp  (($#==0)) && { echo "No paraments!";exit 1; }    if [ ! -d $huishou ]; then      mkdir $huishou  fi   for i in $*  do      if test -e $i          then              cd $(dirname $i)              mv -f $(basename $i) $huishou/$(find $(pwd) -maxdepth 1 -name $(basename $i) | tr "/" "=")              cd -      else          echo "$i:No such file or directory!"      fi  done vi mv.sh#! /bin/bash  #linux恢复cd ~/.temp    list=$(for i in $*; do ls |grep "\<$i\>"; done)    (($#==0)) && { list=$(ls|grep ""); }    for j in $list  do      file=$(echo $j | tr "=" "/")      mv $j ${file%/*}/${file##*/}  done #添加自动任务自动删除临时回收站之前的文件 避免造成文件过大。cat>renwu.sh<
>/var/spool/cron/rootservice crond restartEOF[root@apple home]# chmod 777 rm.sh [root@apple home]# chmod 777 mv.sh[root@apple home]# lsapple  mv.sh  renwu.sh  rm.sh  test[root@apple home]# ./rm.sh test//home[root@apple home]# lsapple  mv.sh  renwu.sh  rm.sh[root@apple home]# ls ~/.temp/=home=test[root@apple home]# ./mv.sh test[root@apple home]# lsapple  mv.sh  renwu.sh  rm.sh  test

转载地址:http://fgaum.baihongyu.com/

你可能感兴趣的文章
数据结构实验之排序二:交换排序
查看>>
【视频教程】Mini6410/Tiny6410的国嵌视频教程光盘,总共五张
查看>>
桶排序
查看>>
追MM与Java的23种设计模式[转]
查看>>
线程 2
查看>>
[C#][控件]文本类控件
查看>>
[Multimedia][MPEG2]MPEG-2系统原理
查看>>
背包九讲(转)
查看>>
HDU5988 Coding Contest(浮点费用流)
查看>>
css3文字溢出显示省略号
查看>>
Rugy 茶余饭后
查看>>
Linux shell中运行命令后加上字符“&”的作用
查看>>
MySQL存储引擎对比
查看>>
[Android Pro] AsyncTaskLoader vs AsyncTask
查看>>
[Linux] du-查看文件夹大小-并按大小进行排序
查看>>
转:numpy数据集练习——鸢尾花数据集
查看>>
把wcf服务,改成restful方式,以及吐槽
查看>>
SpatiaLite 各版本数据库差异
查看>>
Python变量和数据类型
查看>>
HTML(二)选择器
查看>>