Assign a number to variable
Hi,
I am working on getting the memory of my box and assigning it to a variable I need commands to use both in linux and solaris box. the problem i am facing is ,when try to assign the out of below , i am not able to do it -bash-3.2$ sar -r 5 1 SunOS hostname 5.10 Generic_150400-16 sun4v 07/11/2015 00:42:17 freemem freeswap 00:42:22 373643 47222800 now i need to store the value 373643 (first value of the output) to a variable..... Please suggest some ideas |
Assign a number to variable
Please refer to the following link for a very basic explanation of bash variables.
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-5.html It's a relatively short document, and I recommend reading the whole thing. I also recommend reading the Advanced Bash Scripting guide, here: http://www.tldp.org/LDP/abs/html/ |
You might also like to look at cut &/or awk.
|
All times are GMT -5. The time now is 11:44 AM. |