HI all, actually I solved this problem by using expect scripting http://en.wikipedia.org/wiki/Expect Other than that, SebastianUnger think we can use "sleep" in shell script to archive that: { echo "addent -password -p ${PRINCIPAL} -k ${KVNO} -e des-cbc-crc" sleep 1 echo "${PASSWORD}" sleep 1 wkt new.keytab } | ktutil But I haven't tried that out