1833452 Members
3354 Online
110052 Solutions
New Discussion

How to call variable

 
Khalid Shakoor
Regular Advisor

How to call variable

Hi Gurz,
Currently I have Two machine running UNIX, Now I want to create a script to do the below action.
I do ssh From Machine A to Machine B and store the value in one variable. Now currently the variable in Server B and I want to call this variable in machine A How’s its possible
For example
On Machine B
ps -ef | grep TradeEngine
It show me process output
Now I login Machine A and d0
ssh user@machineB
astat=`ps -ef | grep TradeEngine | grep -v "grep" | wc -l`
Now the value is store in astat ,I want to call astat on machine A which is currently in Machine B.
I really appreciated if someone share with me the way .

Thanks in advance.
Khalid
2 REPLIES 2
Laurent Menase
Honored Contributor

Re: How to call variable

astat="$(ssh user@machineB 'ps -ef | grep TradeEngine | grep -v "grep" | wc -l')"
Khalid Shakoor
Regular Advisor

Re: How to call variable

Thanks