File: kshrc.ksh

package info (click to toggle)
pdksh 5.2.14-18
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,884 kB
  • ctags: 2,293
  • sloc: ansic: 24,013; perl: 944; makefile: 606; sh: 304; sed: 40
file content (118 lines) | stat: -rw-r--r-- 2,758 bytes parent folder | download | duplicates (7)
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
112
113
114
115
116
117
118
# kshrc.ksh startup file for OS/2 version of ksh

set -o trackall
set -o ignoreeof

alias a:='cd a:.'
alias b:='cd b:.'
alias c:='cd c:.'
alias d:='cd d:.'
alias e:='cd e:.'
alias f:='cd f:.'
alias g:='cd g:.'
alias h:='cd h:.'
alias i:='cd i:.'
alias j:='cd j:.'
alias k:='cd k:.'
alias l:='cd l:.'
alias m:='cd m:.'

alias h='fc -l'
alias j='jobs'
#alias which='type'
alias back='cd -'
alias cls='print -n "\033[H\033[2J"'

alias dir='cmd /c dir'
alias del='cmd /c del'
alias erase='cmd/c erase'
alias copy='cmd /c copy'
alias start='cmd /c start /f'
alias path='print -r $PATH'

alias ll='ls -lsAFk'
alias lf='ls -CAFk'
alias cp='cp -p'
alias ls='ls -F'

clock_p () {
PS1='${__[(H=SECONDS/3600%24)==(M=SECONDS/60%60)==(S=SECONDS%60)]-$H:$M:$S}>'
typeset -Z2 H M S; let SECONDS=`date '+(%H*60+%M)*60+%S'`
}
#function needed by add_path, pre_path, and del_path
no_path () {
  eval _v="\$${2:-PATH}"
  case \;$_v\; in
    *\;$1\;*) return 1 ;;           # no we have it
  esac
  return 0
}
#if $1 exists and is not in path, append it, or prepend it
add_path () {
  [ -d ${1:-.} ] && no_path $* && eval ${2:-PATH}="\$${2:-PATH}\;$1"
}
pre_path () {
  [ -d ${1:-.} ] && no_path $* && eval ${2:-PATH}="$1\;\$${2:-PATH}"
}
#if $1 is in path then remove it
del_path () {
  no_path $* || eval ${2:-PATH}=`eval print -f '\;$'${2:-PATH}'\;' | sed -e "s!;$1;!;!g" -e "s!^;!!" -e "s!;\\$!!" -e "s!;!\\\\\;!g"`
}

unalias login newgrp

if [ "$KSH_VERSION" = "" ]
then PS1='$PWD>'
     return               #bail out for sh which doesn't have edit modes
fi

set -o emacs
bind ^Q=quote
bind ^I=complete
#bind ^[^[=list-file

#The next four have been preprogrammed
bind ^0H=up-history
bind ^0P=down-history
bind ^0K=backward-char
bind ^0M=forward-char

bind ^0s=backward-word
bind ^0t=forward-word
bind ^0G=beginning-of-line
bind ^0O=end-of-line
bind ^0w=beginning-of-history
bind ^0u=end-of-history
bind ^0S=eot-or-delete


FCEDIT=t2
PS1='[!]$PWD: '
function pushd { 
        if [ $# -eq 0 ]
        then    d=~
                set -A dirstk ${dirstk[*]} $PWD
                cd $d
        else    for d in $* 
                do      if [ -d $d ] && [ -r $d ] && [ -x $d ]
                        then    set -A dirstk ${dirstk[*]} $PWD
                                cd $d
                        else    echo "$d: Cannot change directory"
                                break
                        fi
                done
        fi
        echo ${dirstk[*]} $PWD
        unset d ;
}
 
function popd { 
        if [ ${#dirstk[*]} -gt 0 ]
        then    let n=${#dirstk[*]}-1
                cd ${dirstk[$n]}
                unset dirstk[$n]
                echo ${dirstk[*]} $PWD
        else    echo "popd: Directory stack empty"
        fi
        unset n ; 
}