File: dot.bashrc

package info (click to toggle)
iselect 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 828 kB
  • sloc: sh: 3,353; ansic: 2,074; perl: 485; makefile: 137
file content (35 lines) | stat: -rw-r--r-- 691 bytes parent folder | download | duplicates (11)
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
##
##  .bashrc snippet for iSelect-based 'cd' command
##  Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. 
##

#   database scan
cds () {
    (cd $HOME; 
     find . -type d -print |\
     sed -e "s;^\.;$HOME;" |\
     sort -u >$HOME/.dirs    ) &
}

#   enhanced cd command 
cd () {
    if [ -d $1 ]; then
         builtin cd $1
    else
         builtin cd `egrep "/$1[^/]*$" $HOME/.dirs |\
                     iselect -a -Q $1 -n "chdir" -t "Change Directory to..."` 
    fi
    PS1="\u@\h:$PWD\n:> "
}

#   make sure we stay at $HOME and 
#   that prompt gets initialized
cd

#   change to parent dir
alias -- -='cd ..'

#   change to last dir
alias .='cd $OLDPWD'

##EOF##