下面是代码:
注意:

1、if [ expression ],表达式两边需要空格

2、a=$[aa],字符串转为int类型

3、赋值的时候不能有空格

#!/bin/shell
fn="file_1"
to="file_2"
for file in `ls $fn`
do
     echo $file
     aa=`ls -l $fn/$file | awk '{ print $5}'`
     echo $aa
     a=$[aa]
     if [ $a -gt 0 ];then
          `cp $fn/$file $to/$file`
     fi
done

 

相关文章:

  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
猜你喜欢
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
  • 2021-05-25
  • 2021-10-05
相关资源
相似解决方案