'script' command exits immediately

I'm trying to capture the output of some commands with the 'script' utility. Normally, I would type 'script /path/to/output/file', then enter commands, then hit ctrl+D to end the 'script' capture. I'm having trouble with it on a server. Upon starting 'script', it exits immediately before I type any commands or hit ctrl+D.

Anyone know how/why this could happen?

Thanks in advance for any help you can provide.

What does

which script

show

'which script' shows that /usr/bin/script is running. BTW, I didn't mention before, this is Solaris 8.

---------- Post updated at 08:21 PM ---------- Previous update was at 08:03 PM ----------

I am trying to login to a router from my server & get a screen capture of some output. I used a workaround of "(ssh router) 2>&1 | tee /tmp/output.txt" which seems to work, but I'm still curious why 'script' was exiting immediately.

It shows that it's running? Er, what does it actually show? Copy-paste the result.

=>which script
/usr/bin/script
=>

Before starting "script":

echo $SHELL
tty

If $SHELL is not a valid shell that might be you problem.
If tty replies "not a tty" , that is your problem.

AHA! $SHELL was set to /usr/bin/no_shell.ksh. Looks like it was an attempt at security by another user. It was doing some user validation before running /usr/bin/ksh. I set SHELL=/usr/bin/ksh and 'script' works as expected.

Thanks!