Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-08-2008, 04:10 AM   #1
LQ Newbie
Registered: Sep 2008
Posts: 15

Rep: Reputation: 0
how to get free memory of the unix system

i try

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
Old 10-08-2008, 04:14 AM   #2
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 39
Use double quotes when you're storing the value of bootinfo into free_memory.
free_memory="bootinfo -r"
Old 10-08-2008, 04:17 AM   #3
Mr. C.
Senior Member
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
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 ))
Old 10-08-2008, 08:53 PM   #4
LQ Newbie
Registered: Sep 2008
Posts: 15

Original Poster
Rep: Reputation: 0
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??

Old 10-08-2008, 09:43 PM   #5
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,406

Rep: Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396
see my answer to your repeat of this qn in the other thr.
Don't do that again though.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between resident memory,shared memory and virtual memory in system monitor mathimca05 Linux - Newbie 1 11-11-2007 04:05 AM
Free Memory Not Reclaimed By System Sheado Programming 3 09-28-2007 03:38 PM
installed system memory differs from mounted (available) memory landroni Debian 5 08-13-2007 06:43 AM
Does free( ) immediatly free the memory? Rayven Programming 24 11-06-2006 02:24 AM
LXer: Move an entire file system on a live Unix system LXer Syndicated Linux News 0 07-08-2006 05:33 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:23 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration