At some point, from CentOS 6.3 to 7.6 (with TCL 8.5), the /usr/bin/unbuffer script was changed to run tclsh, directly, instead /usr/bin/expect
If you have tclsh version 8.6 in PATH, prior to /usr/bin/tclsh (v8.5) the unbuffer command will give an error.
[~/tmp]% unbuffer ls
can't find package Expect
while executing
"package require Expect"
(file "/usr/bin/unbuffer" line 6)
expect version 5.45.4 of unbuffer calls ‘tclsh’ without specifying the location of tclsh, depending on $PATH to locate it.
If it had been written ‘exec /usr/bin/tclsh’ instead of ‘exec tclsh’, there would not be a problem.
A work-around, so as to always execute /usr/bin/tclsh, would be to modify /usr/bin/unbuffer in place, or copy to the first folder in PATH, and edit line 4 of the script
4c4
< exec tclsh "$0" ${1+"$@"}
exec /usr/bin/tclsh "$0" ${1+"$@"}
Perhaps the full path of tclsh should be specified in the /usr/bin/unbuffer script?
Correction: Not another version of tclsh but rather a script called tclsh which does something unexpected. If the irregular tclsh occurs in PATH, prior to /usr/bin/tclsh then something unexpected may occur. The remedy, I still think, is to call /usr/bin/tclsh rather than tclsh