Multiple Spawn Ids In expect_background
Multiple spawn ids and patterns can be provided in a single expect_background command. Each time a particular spawn id appears, it replaces the previous background pattern associated with that spawn id. It is possible to declare multiple spawn ids together and change or delete some or all of them separately.
Multiple spawn ids are accepted using the "-i "$id1 $id2 $id3"" notation or via an indirect spawn id specification (see Chapter 11 (p. 264)). When indirect spawn id lists change, the background patterns are immediately disassociated from the old spawn ids and reassociated with the new spawn ids.
In Chapter 11 (p. 262), I described how the -info flag is used to return the association patterns from expect_before and expect_after. The -info flag works with expect_background as well.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access