Skip to content
Snippets Groups Projects
Commit 2a9a76df authored by Per Cederqvist's avatar Per Cederqvist
Browse files

New demo, extracted from pcl_expect.py.

parent e773befe
No related branches found
No related tags found
No related merge requests found
from pcl_expect import controller
from pcl_expect.popen import popen
df = popen("df -k")
x = controller()
while x.loop():
if x.re(df, "Filesystem.*\n"):
print "Header:", df.match.group()
x = controller()
while x.loop():
if x.re(df, "^/.* .*(?=\n)"):
print "Normal line:", df.match.group()
x.cont()
continue
elif x.re(df, "^/.*(?=\n)"):
print "Mount point only:", df.match.group()
x.cont()
continue
elif x.re(df, "^ .*(?=\n)"):
print "Info only:", df.match.group()
x.cont()
continue
elif x.re(df, "^\n"):
x.cont()
continue
elif x.re(df, "^.*(?=\n)"):
print "Unexpected line", df.match.group()
x.cont()
continue
elif x.eof(df):
print "And that's all, folks!"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment