[pez@foo ~]$ cat testexpect #!/usr/bin/expect -f gets stdin user send_user "Got user: $user\n" [pez@foo ~]$ echo -e "hello\n" | ./testexpect Got user: [pez@foo ~]$ echo hello | ./testexpect Got user: [pez@foo ~]$