Uwe’s post about script reminded me that script just doesn’t seem to work for me for some reason anymore on Debian (both sarge and etch). I also see it sometimes on work’s RHEL-alike machines, but not all of them!
Here’s what happens:
$ script
Script started, file is typescript
bash: No such file or directory
Script done, file is typescript
$
What’s going on there? I’m sure it’s something simple. This has been happening for ages (more than a year) but I always get distracted when a simple search doesn’t turn up an answer to it. Any ideas?
Update… ^
huggie suggested I use strace to see what was going on. I have tried this before but I should have paid more attention, and done it again anyway, because now I can sort of see what is going on:
setsid() = 31937
ioctl(5, TIOCSCTTY) = 0
close(4) = 0
close(3) = 0
dup2(5, 0) = 0
dup2(5, 1) = 1
dup2(5, 2) = 2
close(5) = 0
execve("bash", ["bash", "-i"], [/* 22 vars */]) = -1 ENOENT (No such file or directory)
.
.
.
It is literally calling “bash” with no path. If I cd to /bin and do it then it works. Also this works:
$ SHELL="/bin/bash" script
Script started, file is typescript
$
Note:
$ echo $SHELL
bash
I still don’t know what exactly is going on, but at least I have a workaround now.