I use this command for remote server.

# now=`ssh root@ -t uptime | awk '{ print $8  }'`
echo "$now"

I get "Connection to closed." but i don't want show this message. I want show only output command. thanks.


Since this goes to stderr, you can pipe it to /dev/null:

ssh root@ -t uptime 2>/dev/null | awk '{ print $8 }'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.