-->
当前位置:首页 > 题库 > 正文内容

主观题:h10.编写个shell 脚本将/boot/grub/目录下大于100K 的文件转移到/opt 目录下

Luz3年前 (2022-10-05)题库317
10.编写个shell 脚本将/boot/grub/目录下大于100K 的文件转移到/opt 目录下。







答案:参考答案:
[root@xuegod63 ~]# cat test.sh

#!/bin/bash

cd /boot/grub

for file in ls /boot/grub

#for file in ls /boot/grub

do

if [ -f $file ]; then

if [ ls -l $file|awk '{print $5}' -gt 10000 ]; then

mv $file /opt/

fi

fi

done


发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。