()
Find an appropriate shell for the user
Find an appropriate shell for the user
Find an appropriate shell for the user
def shell_lookup():
    """Find an appropriate shell for the user"""
    try:
        usershell = pwd.getpwuid(os.getuid())[6]
    except KeyError:
        usershell = None
    shells = [usershell, 'bash', 'zsh', 'tcsh', 'ksh', 'csh', 'sh']

    for shell in shells:
        if shell is None:
            continue
        elif os.path.isfile(shell):
            return(shell)
        else:
            rshell = path_lookup(shell)
            if rshell is not None:
                dbg('shell_lookup: Found %s at %s' % (shell, rshell))
                return(rshell)
    dbg('shell_lookup: Unable to locate a shell')
def shell_lookup ( ) : try : usershell = pwd . getpwuid ( os . getuid ( ) ) [ 6 ] except KeyError : usershell = None shells = [ usershell , 'bash' , 'zsh' , 'tcsh' , 'ksh' , 'csh' , 'sh' ] for shell in shells : if shell is None : continue elif os . path . isfile ( shell ) : return ( shell ) else : rshell = path_lookup ( shell ) if rshell is not None : dbg ( 'shell_lookup: Found %s at %s' % ( shell , rshell ) ) return ( rshell ) dbg ( 'shell_lookup: Unable to locate a shell' )