(原标题为:求解:一个菜鸟编程中的问题!)
编写了一个shell命令cp
代码如下:
#include
by melonmelon - C/C++ - 2006-12-28 20:35:32 阅读(4243) 回复(10)
我用 if [ $i -eq 100 ] 就出现了这个错误:integer expression expected 从字面上理解就是变量i应该是个integer类型的 但是如何把一个字符型数字转换成整形呢?
#include
#include
#!/bin/sh count=2 while [ 0 ];do if [ $count%2 -eq 0 ];then date -s 12:12:00 fi if [ $count%2 -ne 0 ];then date -s 12:34:00 fi sleep 10 let count=$count+1 done 结果如下: ./changetime.sh: line 6: [: 2%2: integer expression expected ./changetime.sh: line 9: [: 2%2: integer expression expected 我又使用了"$count%2" 还是这个问题,点解?
我的程序如下: NUM=`awk '/NUM/{sub(/NUM=/,"");print}' $DIR/logzdm.ini` processID=1 while [ $processID -le $NUM ]; do values=DEBUGLOG${processID}= process_content=`grep $values $DIR/logzdm.ini | awk -F= '{print $2}'` ; echo $process_content | sed 's/\"\"*//g' ; processID=`expr $processID + 1`; done logzdm.ini 文件内容: #プロセスの件数 NUM=12 ------------------NUM 数每次都可能变化,并且...
这段shell在一个嵌入式系统上运行超过48小时,有很大几率出现integer expression expected的问题。请大家帮帮忙,看一下。 ********************************************************************* #!/bin/sh #try try_1() { cd /xx/ find /xx/ ! -type d | xargs ls -trl | sed '/bak/d' | awk '{print $9}' | sed -n '1,6p' | xargs rm -f>/dev/null 2>&1 delete } main() { sleep 5 choice } choice() { used=`df | awk...
AS Regular expression A regular expression is a pattern to match against an input string. By building a regular expression we specify a string that input must match. In case of BGP we are specifying a string consisting of path information that an input should match. In the previous example we specified the string ^200$ and wanted path information coming inside updates to match it in order to perfo...
以下是port.sh的内容 #! /bin/bash # program: Using to study the [if... then ...fi] program # Written by :Beyond # date: 2007/06/15 # content: I will be using this program to show your services # 1. print the program's work in your screen echo "Now, the services of your Linux system will be detect!" echo "The www, ftp, ssh, and sendmail + pop3 will be detect!" echo " " # 2. www www='netstat ...