哪位高手帮忙改改

sh/bash/dash/ksh/zsh等Shell脚本
回复
liucheng1513
帖子: 62
注册时间: 2010-09-08 18:17

哪位高手帮忙改改

#1

帖子 liucheng1513 » 2010-09-12 21:15

执行下列代码出现[root@localhost ~]# ./testing.sh
./testing.sh: line 3: [: too many arguments
提示。哪位高手帮忙改改


#! /bin/bash
isok=`ls -l|awk '{print $8}' | awk -F: '{print $1}'`
if [ $isok -gt 12 ];then
for i in /home/work/dl_stat/*.log; do mv "$i" "`sed 's|_0_|_1_|' <<< "$i"`"; done
else
echo
fi
tusooa
帖子: 6548
注册时间: 2008-10-31 22:12
系统: 践兔
联系:

Re: 哪位高手帮忙改改

#2

帖子 tusooa » 2010-09-12 21:42

if [ "$isok"

代码: 全选

] ls -ld //
liucheng1513
帖子: 62
注册时间: 2010-09-08 18:17

Re: 哪位高手帮忙改改

#3

帖子 liucheng1513 » 2010-09-12 21:51

#! /bin/bash
isok=`ls -l|awk '{print $8}' | awk -F: '{print $1}'`
if [ "$isok" -gt "12" ];then
for i in /home/work/dl_stat/*.log; do mv "$i" "`sed 's|_0_|_1_|' <<< "$i"`"; done
else
echo
fi


加完了提示[root@localhost ~]# ./testing.sh
./testing.sh: line 3: [:
12
12
12
12
21: integer expression expected
回复