linix bash script

Thread Starter

electronis whiz

Joined Jul 29, 2010
i have to make a linix bash script for a class using our pdf book and somwhere on this sit it sounded like there was a test shell to try it saw nothing anywhere after liiking for aprox an hour. googled found somthin but think the flavor is wrong so my script wont work. can anyone take a look at this script for me. it looks like it should work. howeve if i can i would like to somhow get a total of every ramstick this command dosn't apear to do it. and a scripted calculator because there names of the valuse are the same i don't think will work. this script is suposed to work like a WMI filter use by windows domains.
script is in atched notpad
thanks for any help



Joined Feb 19, 2009
You aren't calling bash properly.

First line should be:

Not #/bin!/bash

Try this script, expand on it.

Rich (BB code):
freemem=`free | awk 'NR==2{print $4}'`
totalmem=`free | awk 'NR==2{print $2}'`
echo Hello, you have $freemem bytes of free RAM out of $totalmem available
if [ $freemem -ge 256000 ]
        echo you have at least 256,000 bytes of free memory
        echo Only $freemem bytes of RAM are available, at least 256k is needed
Remember to use the backtick ` to assign the output of a command to a variable in bash
Last edited: