buildtest.utils.shell
¶
Module Contents¶
Classes¶
- class buildtest.utils.shell.Shell(shell='bash')¶
- valid_shells = ['bash', 'sh', 'zsh', 'csh', 'tcsh', '/bin/bash', '/bin/csh', '/bin/sh', '/bin/tcsh',...¶
- __repr__(self)¶
Return repr(self).
- __str__(self)¶
Return str(self).
- get(self)¶
Return shell attributes as a dictionary
- property opts(self)¶
retrieve the shell opts that are set on init, and updated with setter
- property path(self)¶
This method returns the full path to shell program using
shutil.which()
If shell program is not found we raise an exception. The shebang is is updated assuming path is valid which is just adding character ‘#!’ in front of path. The return is full path to shell program. This method automatically updates the shell path when there is a change in attribute self.name>>> shell = Shell("bash") >>> shell.path '/usr/bin/bash' >>> shell.name="sh" >>> shell.path '/usr/bin/sh'