Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] bash question
- Date: 17 Feb 2003 21:25:20 +0900
- From: bruno raoult <br@example.com>
- Subject: Re: [tlug] bash question
- References: <3E50D037.80506@example.com>
On Mon, 2003-02-17 at 21:06, Jean-Christian Imbeault wrote: > I can't seem to find the proper bash syntax for this simple thing. > > #!/bin/sh > procs=`ps -aux | wc -l` > if ($procs > 400) then > echo "You have more than 400 procs running" > fi > > If I run this I get: > > # ./t.sh > ./t.sh: 468: command not found > > $procs is being interpreted as a command instead of an argument ... what > is the proper bash syntax to get a comparison done? > > I've also tried: > > if [ $proc -gt 400 ] then > echo "You have more than 400 procs running" > fi > > but that throws a: > > ./t.sh: line 5: syntax error near unexpected token `fi' > ./t.sh: line 5: `fi' > > > Thanks, > > Jc Try "man test". In fact, test is symlinked to '[', meaning that the test syntax can be used in shell as well with the '[', such as (in your case): if [ $proc -gt 400 ] then echo etc... fi or: if [ $proc -gt 400 ]; then echo etc... fi br. -- GPG Key: 653514E5 (http://www.raoult.com/gpg) -- Computers are like air-conditions. They don't properly work, if you open Windows.Attachment: signature.asc
Description: This is a digitally signed message part
- References:
- [tlug] bash question
- From: Jean-Christian Imbeault
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] bash question
- Next by Date: Re: [tlug] bash question
- Previous by thread: Re: [tlug] bash question
- Next by thread: RE: [tlug] bash question
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links