We’ll show you how to automate shell scripts with expect command. The “Expect” name comes from the concept of sending/waiting for sequences popular by uucp, kermit and various modem management programs. However, not like uucp, Expect is generalized so it can be executed as a user-level command with any program and task in mind. Expect can communicate with multiple programs at the same time. In other words the Expect is a program that talks to a variety of interactive programs according to the script.
script
Bash Array: find the first missing integer
The script below will find the first missing number in an array of integers.