+(defvar eshell-needs-pipe '("bc")
+ "List of commands which need `process-connection-type' to be nil.
+Currently only affects commands in pipelines, and not those at
+the front. If an element contains a directory part it must match
+the full name of a command, otherwise just the nondirectory part must match.")
+
+(defun eshell-needs-pipe-p (command)
+ "Return non-nil if COMMAND needs `process-connection-type' to be nil.
+See `eshell-needs-pipe'."
+ (and eshell-in-pipeline-p
+ (not (eq eshell-in-pipeline-p 'first))
+ ;; FIXME should this return non-nil for anything that is
+ ;; neither 'first nor 'last? See bug#1388 discussion.
+ (catch 'found
+ (dolist (exe eshell-needs-pipe)
+ (if (string-equal exe (if (string-match "/" exe)
+ command
+ (file-name-nondirectory command)))
+ (throw 'found t))))))
+