Couldn't you simplify with something like `profile="$(oo-mco rpc rpcutil get_fact fact=node_profile -I$firstnode | awk '{if ("Value:"==$1){print $2}})"`?