def selectHist(hist, num, tty):
    """Bounds check the entered index and select directory if in range"""
    if num < 0 or num >= len(hist):
        tty.write('cdhist: number {} out of range\n'.format(num))
        return 1
    print(hist[num])
    return 0
