I need to monitor the time it takes to rlogin from one HP-UX machine to another.

So I wrote this:

result=`rlogin << EOF
result2=`{ time $result >/dev/null; } |& grep real`
echo $result2

This shellscript works when I run it on a Linux machine, but for some reason it doesn’t work when I run it on HP-UX. Both are using /bin/sh.

Why doesn't it work on HP-UX?

  • Why would one use an insecure protocol like rlogin? – Martin von Wittich Jan 30 '14 at 20:11
  • I've never used rlogin, but this works with ssh and may work with rlogin too: time ssh <host> true – Martin von Wittich Jan 30 '14 at 20:12

You're calling time on the output of the rlogin command. That makes no sense.

|& is a bash feature. Probably your linux system has /bin/sh symlinked to bash, but most likely HP-UX does not.

You probably want:

result=$( time rlogin <<EOF 2>&1
echo "$result" | grep real

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.