| | 75 | |
| | 76 | == Python == |
| | 77 | {{{ |
| | 78 | #!python |
| | 79 | #!/bin/env python |
| | 80 | |
| | 81 | import commands |
| | 82 | |
| | 83 | # Creating a utility function |
| | 84 | def FindDirectory(aDir): |
| | 85 | result = commands.getoutput('finddir %s' % aDir) |
| | 86 | return result |
| | 87 | |
| | 88 | |
| | 89 | if __name__ == "__main__": |
| | 90 | # Using the utility function ... |
| | 91 | B_APPS_DIRECTORY = FindDirectory('B_APPS_DIRECTORY') |
| | 92 | print 'Using utility function:' |
| | 93 | print B_APPS_DIRECTORY |
| | 94 | |
| | 95 | # Set a baloney value, to display functionality |
| | 96 | B_APPS_DIRECTORY='Some Text to display the value being set properly' |
| | 97 | print 'After setting a baloney value:' |
| | 98 | print B_APPS_DIRECTORY |
| | 99 | |
| | 100 | # As a one liner ... |
| | 101 | B_APPS_DIRECTORY = commands.getoutput('finddir B_APPS_DIRECTORY') |
| | 102 | print 'Using a one liner:' |
| | 103 | print B_APPS_DIRECTORY |
| | 104 | }}} |