Hi gurus,
I have only little experience in shell-programming, but
nevertheless, this problem is important for me to be solved.
Inside a script I want to extract one value out of one line from the vmstat -command via ssh to a remote system
vmstat -P under TRU64 UNIX prints dozends of lines about memory-usage, like vmstat -m under Linux).
The COMMANDLINE provides the correct result , like here:
# ssh -l root <remote-ip> vmstat -P|grep -e ''Memory =''|cut -d = -f 2
But things go wrong inside my script:
free=`ssh -l $user $1 vmstst -P|grep -e ''Memory =''|cut -d = -f 2`
(where $user=root and $1=IP-Addr. $free is where I want this one value to be stored)
What I get when I start my script is the whole pile of lines that vmstat -P prints out, as if I didn't use |cut .. at all.
Why does the command-line work correctly and why gets everything printed when I use the script ?
Any help is apreciated.
Thanks in advance for your time.
Regards,
Fred
I have only little experience in shell-programming, but
nevertheless, this problem is important for me to be solved.
Inside a script I want to extract one value out of one line from the vmstat -command via ssh to a remote system
vmstat -P under TRU64 UNIX prints dozends of lines about memory-usage, like vmstat -m under Linux).
The COMMANDLINE provides the correct result , like here:
# ssh -l root <remote-ip> vmstat -P|grep -e ''Memory =''|cut -d = -f 2
But things go wrong inside my script:
free=`ssh -l $user $1 vmstst -P|grep -e ''Memory =''|cut -d = -f 2`
(where $user=root and $1=IP-Addr. $free is where I want this one value to be stored)
What I get when I start my script is the whole pile of lines that vmstat -P prints out, as if I didn't use |cut .. at all.
Why does the command-line work correctly and why gets everything printed when I use the script ?
Any help is apreciated.
Thanks in advance for your time.
Regards,
Fred