How do I get the first string value from function?

Hello All,

I am trying to get the value "node01_mymachine" and disregard the rest of the returned string (command ran*) from myscript.sh

$ myscript.sh GetNodeName
node01_mymachine
Command ran successfully.

If I called from another script like this:
anyprocess=`myscript.sh GetNodeName`
echo "My node name is " $anyprocess " test"

The output is as follows:
My node name is node01_mymachine Command ran successfully. test

How do i extract "node01_mymachine" from the whole returned value?

You would be better off amending the myscript.sh script, rather than calling one script to call another, to call another etc.

But if you can't for whatever reason, with your sample data you could simply do the below:

anyprocess=$(myscript.sh GetNodeName|head -1)
echo "My node name is $anyprocess test"

Thank you pilnet, this works great.