This file is indexed.

/usr/share/ksh/functions/pushd is in ksh 93u+20120801-3.1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
#
# DIRECTORY MANIPULATION FUNCTIONS PUSHD, POPD AND DIRS
#
# Uses global parameters _push_max _push_top _push_stack
integer _push_max=100 _push_top=100
# Display directory stack -- $HOME displayed as ~
function dirs
{
    typeset dir="${PWD#$HOME/}"
    case $dir in
    $HOME)
        dir=\~
        ;;
    /*) ;;
    *)  dir=\~/$dir
    esac
    print -r - "$dir ${_push_stack[@]}"
}

# Change directory and put directory on front of stack
function pushd
{
    typeset dir= type=0
    integer i
    case $1 in
    "") # pushd
        if    ((_push_top >= _push_max))
        then  print pushd: No other directory.
              return 1
        fi
        type=1 dir=${_push_stack[_push_top]}
        ;;
    +[1-9]|+[1-9][0-9]) # pushd +n
        integer i=_push_top$1-1
        if    ((i >= _push_max))
        then  print pushd: Directory stack not that deep.
              return 1
        fi
        type=2 dir=${_push_stack[i]}
        ;;
    *)  if    ((_push_top <= 0))
        then  print pushd: Directory stack overflow.
              return 1
        fi
    esac
    case $dir in
    \~*)   dir=$HOME${dir#\~}
    esac
    cd "${dir:-$1}" > /dev/null || return 1
    dir=${OLDPWD#$HOME/}
    case $dir in
    $HOME)
        dir=\~
        ;;
    /*) ;;
    *)  dir=\~/$dir
    esac
    case $type in
    0)  # pushd name
        _push_stack[_push_top=_push_top-1]=$dir
        ;;
    1)  # pushd
        _push_stack[_push_top]=$dir
        ;;
    2)  # push +n
        type=${1#+} i=_push_top-1
        set -- "${_push_stack[@]}" "$dir" "${_push_stack[@]}"
        shift $type
        for dir
        do  (((i=i+1) < _push_max)) || break
            _push_stack[i]=$dir
        done
    esac
    dirs
}

# Pops the top directory
function popd
{
    typeset dir
    if    ((_push_top >= _push_max))
    then  print popd: Nothing to pop.
          return 1
    fi
    case $1 in  
    "")
        dir=${_push_stack[_push_top]}
        case $dir in
        \~*)   dir=$HOME${dir#\~}
        esac
        cd "$dir" || return 1
        ;;
    +[1-9]|+[1-9][0-9])
        typeset savedir
        integer i=_push_top$1-1
        if    ((i >= _push_max))
        then  print pushd: Directory stack not that deep.
              return 1
        fi
        while ((i > _push_top))
        do _push_stack[i]=${_push_stack[i-1]}
              i=i-1
        done
        ;;
    *)  print pushd: Bad directory.
        return 1
    esac
    unset '_push_stack[_push_top]'
    _push_top=_push_top+1
    dirs
}