由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - hwo to solve it
相关主题
AWK problem, SOS!how to fix login problem ( can't read .cshrc file
Re: 如何限制用户锁屏?为什么我就是不会写Shell script?
Help!How to open *.bin files?
为什么root都无权改文件?怎么在FTP里改变文件属性?
[转载] Re: about incoming emaila question in shell script
CXTERM 终结说明Re: INIT: Cannot create /var/adm/utmp or /var/adm/utmpx (help!)
Re: 没有chmod怎么改权限?[转载] 简单问题 -- about shell script
root做不到的事?[转载] a question about shell script
相关话题的讨论汇总
话题: acces话题: counter话题: echo话题: hwo话题: file
进入Unix版参与讨论
1 (共1页)
s*****i
发帖数: 650
1
#!/bin/sh
#counter file must be chmod 666
counter=../cgi-bin/counter
echo "Content-Type: text/html"
echo ""
read acces < $counter
acces = 'expr $acces+1'
echo $acces
echo $acces > $counter
counter is a text file which only value inside is 1.
I want to increase the value of file counter by 1 and store it back to file
counter.
when I run it in shell, it always tell me: command acces not found.
why?
thx
s**i
发帖数: 30
2
if in bash

acces=`expr $acces + 1`
you should use back quote and if you want to set number to a variable
in this form there should be no blank before and after the '=' and there
should be space before and after the '+'

【在 s*****i 的大作中提到】
: #!/bin/sh
: #counter file must be chmod 666
: counter=../cgi-bin/counter
: echo "Content-Type: text/html"
: echo ""
: read acces < $counter
: acces = 'expr $acces+1'
: echo $acces
: echo $acces > $counter
: counter is a text file which only value inside is 1.

1 (共1页)
进入Unix版参与讨论
相关主题
[转载] a question about shell script[转载] Re: about incoming email
cxterm compile (successful !!! @_@)CXTERM 终结说明
请教e-mail的设置Re: 没有chmod怎么改权限?
Freebsd下如何给多网卡绑定同一IP?root做不到的事?
AWK problem, SOS!how to fix login problem ( can't read .cshrc file
Re: 如何限制用户锁屏?为什么我就是不会写Shell script?
Help!How to open *.bin files?
为什么root都无权改文件?怎么在FTP里改变文件属性?
相关话题的讨论汇总
话题: acces话题: counter话题: echo话题: hwo话题: file