how to get free memory of the unix system
i try
#!/bin/bash free_memory = bootinfo -r x = 'expr $free_memory*10' why does it complaint -r command not found. but i try the command bootinfo -r in shell its ok |
Use double quotes when you're storing the value of bootinfo into free_memory.
Code:
free_memory="bootinfo -r" |
Assign variables without spaces, and use quotes for multiple words:
free_memory='bootinfo -r' But I think you want command substitution: free_memory=$(bootinfo -r) You can avoid the expr call and use bash built-in arithmetic expansion: (( x = free_memory * 10 )) |
i try :
free_mem="bootinfo -r" num_4k='expr free_mem*0.75/536870912' num_64k='expr free_mem*0.85/134217728' sed -n s/num_seg_4k=[0-9]*/num_seg_4k=$num_4k/p default sed -n s/num_seg_64k=[0-9]*/num_seg_64k=$num_64k/p default but it give the following error: sed: 0602-404 Function s/num_seg_4k=[0-9]*/num_seg_4k=expr cannot be parsed. sed: 0602-404 Function s/num_seg_64k=[0-9]*/num_seg_64k=expr cannot be parsed. what could be wrong?? thanks |
see my answer to your repeat of this qn in the other thr.
Don't do that again though. |
All times are GMT -5. The time now is 09:35 AM. |