buildtest.utils.shell
¶
Module Contents¶
Classes¶
The Shell initializer takes an input shell and shell options and split |
- class buildtest.utils.shell.Shell(shell='bash')[source]¶
The Shell initializer takes an input shell and shell options and split string by shell name and options.
- Parameters
shell (str) – Specify shell program and any options passed to shell. Defaults to
bash
- valid_shells = ['bash', 'sh', 'zsh', 'csh', 'tcsh', '/bin/bash', '/bin/csh', '/bin/sh', '/bin/tcsh',...¶
- 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'