ChinaUnix.net
相关文章推荐:

shell脚本 while

源代码: #!/bin/sh DIR="/jing/" IP="127.0.0.1" while read ADDRESS do wget -t 3 "http://""${ADDRESS}""${DIR}""20071025.txt" done < "/var/www/html/jing/ip_list.txt" 提示错误: ': not a valid identifierta.sh: line 4: read: ` 请问是什么原因?

by wingjang - Linux环境编程 - 2007-11-01 20:12:56 阅读(4950) 回复(6)

相关讨论

function waithadoop() { while [1-eq1] do reduceNum=`hd -ls $1 | wc -l` if [ ${reduceNum} -ne $2 ] ; then sleep 1; else break; fi done } waithadoop path 50 写了这样一个shell程序,执行后报错 ./run.sh.bak: line 3: [1-eq1]: command not found 这个怎么改啊?

by liumilan2009 - Shell - 2013-09-03 08:47:43 阅读(19466) 回复(6)

#!/bin/sh while read LINE do echo $LINE done < names.txt 问:循环执行的第一次,LINE值为多少? 文件names.txt的第一行数据? 求问为什么

by abel_19 - Linux新手园地 - 2013-05-02 14:31:44 阅读(1975) 回复(5)

visit=2 link=2 download=2 while [ ($visit -eq 2) || ($link -eq 2) || ($link -eq 2) ] do vmstat |tail -1 >> per_test.log done 执行一个包含上述几行语句的shell脚本时,报错 four.sh: line 5: [: missing `]' four.sh: line 5: 2: command not found

by alizh - 系统管理 - 2006-03-10 09:08:13 阅读(1845) 回复(5)

visit=2 link=2 download=2 while [ ($visit -eq 2) || ($link -eq 2) || ($link -eq 2) ] do vmstat |tail -1 >> per_test.log done 执行一个包含上述几行语句的shell脚本时,报错 four.sh: line 5: [: missing `]' four.sh: line 5: 2: command not found

by alizh - Linux系统管理 - 2006-03-10 09:08:13 阅读(7139) 回复(5)

本帖最后由 奋斗的毛毛虫 于 2016-03-10 22:41 编辑 while read f_OSMSG // (1) 请问这句话是什么意思呢? do let f_LINE=${f_LINE}+1 f_LINE=$(printf "%4.4d\n" ${f_LINE}) f_MSG="\"${g_PGM##*/}-${g_PID}\",\"$(date +'%Y/%m/%d %H:%M:%S')\"" f_MSG="${f_MSG},\"$2\",\"$3\",\"${f_LINE} ${f_OSMSG}\"" echo ${f_MSG} | iconv -f UTF-8 -t SJIS >> ${f_LOGFILE} |...

by 奋斗的毛毛虫 - Shell - 2016-03-16 18:10:04 阅读(1282) 回复(6)

#!/bin/bash for file do if [ -f $file ] then echo "$file为普通文件" elif [ -d $file ] then echo "$file为目录文件" elif [ -b $file ] then echo "$file为块设备文件" elif [ -c $file ] then echo "$file为字符设备文件" elif [ -h $file ] then echo "$file为链接文件" else echo "没有这个文件类型" fi done //以上是用for循环判断是啥文件。-f为普通文件,...

by jack_zyk - Shell - 2012-03-08 09:37:10 阅读(2190) 回复(3)

shell脚本中调用sql时涉及到一个分区的问题,所以我想使用while循环来一个个调用分区,但是本人第一次看shell脚本的东西,请各位多多指教 #!/bin/sh set -x n=0 while ((n<1000)); do sqlplus user/pass@sid<

by xuexuan99 - Shell - 2005-04-01 17:45:16 阅读(3141) 回复(4)

我的目的是一个脚本连接DB2 数据库,根据查询结果,做while 循环,在循环里面调用第二个脚本,第二个脚本里面仅仅是ssh 命令,在ssh 的目标server上执行其它的脚本 现在的问题是,第一个脚本while 脚本都只执行一次,但是如果将调用第二个脚本的命令mark掉,就会执行多次了,直到while条件不满足 第一个脚本基本如下: ssql=“select a,b,c from table1 " sdata='db2 -t "$ssql"' while read a b c #while条件可以执行多次 do...

aixshell脚本调用脚本

by dianzi011sh - Shell - 2015-07-21 17:59:41 阅读(1325) 回复(2)

我是刚刚学习shell的新手。问问while的使用。 我想每3分钟统计一下系统当前目录下的文件和目录的总和,我这样做。 #while >ls|wc >done # 时间上我如何做内,我应该如何写呢。谢谢!

by sunnycn - Shell - 2004-08-28 22:08:11 阅读(1697) 回复(2)

URL=“” cat url|while read line do i=`expr $count - 1` urlt[$i]=$line URL=$URL${urlt[$i]} count=$[ $count + 1 ] echo "URL="$URL done echo "URL="$URL 想要把url文件里边每行的内容拼接在一起赋值给变量URL,但是只有在while循环里边有效,外部全局变量最后的输出还是原来的值“”,请问要怎样才能在while中修改全局变脸的值呢?

by yns_btbu - Shell - 2016-06-17 16:29:57 阅读(1673) 回复(3)