Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] bash question



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



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links