0

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

So I wrote this:

#!/bin/sh
result=`rlogin 10.10.10.1 << EOF
exit
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
1

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:

#!/bin/sh
result=$( time rlogin 10.10.10.1 <<EOF 2>&1
exit
EOF
)
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.