diff options
Diffstat (limited to 'examples/script_conditional.py')
-rw-r--r-- | examples/script_conditional.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/script_conditional.py b/examples/script_conditional.py index 3964ab6d..f0ded920 100644 --- a/examples/script_conditional.py +++ b/examples/script_conditional.py @@ -5,7 +5,7 @@ This is a Python script intended to be used with the "python_scripting.py" cmd2 To run it you should do the following: ./python_scripting.py py run('script_conditional.py') - + Note: The "cmd" function is defined within the cmd2 embedded Python environment and in there "self" is your cmd2 application instance. """ @@ -17,8 +17,14 @@ cmd('cd foobar') if self._last_result: print('Contents of foobar directory:') cmd('dir') + + # Change back to where we were + cmd('cd ..') else: # Change to parent directory cmd('cd ..') print('Contents of parent directory:') cmd('dir') + + # Change back to where we were + cmd('cd examples') |