#!/usr/bin/expect -f set timeout -1 set patchfile [lindex $argv 0] spawn sh -c "patch -p1 < $patchfile" expect "Assume -R?" send -- "y\r"