ChinaUnix.net
相关文章推荐:

linux 脚本 while

大家好,我的linux的版本是Fedora。我在BASH下,编写了一个while脚本,如下: #!/bin/sh INPUT_STRING=hello while ["$INPUT_STRING"!="bye"] do echo "Please type something in (bye to quit)" read $INPUT_STRING echo "You typed:$INPUT_STRING" done 脚本提示出错, hello=bye 命令不能找到,将do换到下面的位置 #!/bin/sh INPUT_STRING=hello while ["$I...

by wanfei - Linux论坛 - 2004-09-21 11:57:37 阅读(6482) 回复(9)

相关讨论

大家好,我的linux的版本是Fedora。我在BASH下,编写了一个while脚本,如下: #!/bin/sh INPUT_STRING=hello while ["$INPUT_STRING"!="bye"] do echo "Please type something in (bye to quit)" read $INPUT_STRING echo "You typed:$INPUT_STRING" done 脚本提示出错, hello=bye 命令不能找到,将do换到下面的位置 #!/bin/sh INPUT_STRING=hello while ["$I...

by wanfei - Linux系统管理 - 2004-09-21 11:57:37 阅读(3857) 回复(9)

原理机制: 有两个shell脚本, 1个是用来每5分钟ping一次百度, 然后把结果写入文本文件; 另外一个是每隔8分钟来读取该文本文件中出现"网络故障"的次数, 如果超过2次以上的"网络故障"则重启系统, 这两个脚本都是用while死循环体来控制时间间隔. 这两个脚本可以通过测试. 遇到问题: 我把这两个shell脚本放到开机启动项中(/etc/rc.local)出现问题, 发现重启后这两个脚本只有pingReboot1.sh的线程启动了, 而第二个未启动. 下面是我写的...

by 程序员JZ - Shell - 2014-11-21 14:24:22 阅读(809) 回复(0)

编写脚本循环取出文件 a.txt 中每一行,并将其赋予 aa for i in `cat a.txt` do aa=$i done 若每一行只有一個詞的話,那才行。若有兩個詞或以上呢? 或許試試: cat a.txt | while read aa do echo $aa done 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/18630/showart_1670399.html

by zbhdpx - BSD文档中心 - 2008-11-28 10:47:46 阅读(2115) 回复(0)

源代码: #!/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)

本帖最后由 ding_cw 于 2013-09-23 15:21 编辑 麻烦大神看看 只有第一段while do done是正常运行的 后面的没有运行 是哪里的错误 #!/bin/bash /usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f' -e close_write,delete,create,attrib /data/aaa | while read files do /usr/bin/rsync -vzrtopgu /data/aaa /data/ccc >/dev/null 2>&1 echo "${files} was rsynced" ...

by ding_cw - Shell - 2013-09-23 22:15:30 阅读(3748) 回复(3)

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 阅读(19603) 回复(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 阅读(1983) 回复(5)

想实现的是,执行gt.sh 脚本,当我输入 -e 执行 copy_log="${OPTARG}",当我输入-t 执行day=="${OPTARG}", 当我不输入参数是,执行usage函数[code]#!/usr/bin/sh usage() { echo "No correct parameters" exit 0 } while read getopts "e:t:" OPTION do case $OPTION in e) copy_log="${OPTARG}" ;; t) day=="${OPTARG}" ;; *|\?)usage ...

by y331044508 - Shell - 2011-10-18 09:05:42 阅读(1960) 回复(6)

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 阅读(1846) 回复(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 阅读(7156) 回复(5)