# linix bash script

#### electronis whiz

Joined Jul 29, 2010
512
i have to make a linix bash script for a class using our pdf book and http://linuxconfig.org/bash_scripting_tutorial. 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

#### Attachments

• 308 bytes Views: 12

#### thatoneguy

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

First line should be:
#!/bin/bash

Not #/bin!/bash

Try this script, expand on it.

Rich (BB code):
#!/bin/bash
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 ] then echo you have at least 256,000 bytes of free memory else echo Only$freemem bytes of RAM are available, at least 256k is needed
fi
Remember to use the backtick ` to assign the output of a command to a variable in bash

Last edited: