Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: |
Timelines: |
family
| ancestors
| descendants
| both
| mksh
|
Files: |
files
| file ages
| folders
|
SHA1: |
6468d8b10dd87b1e18a1bf171277183a6b44d30a |
User & Date: |
vdh
2019-12-22 17:08:52 |
Context
2019-12-22 17:13 |
|
check-in: a28d3150c6 user: vdh tags: ksh
|
2019-12-22 17:10 |
|
check-in: cf34cbb665 user: vdh tags: mksh
|
2019-12-22 17:08 |
|
check-in: 6468d8b10d user: vdh tags: mksh
|
2019-12-22 16:20 |
|
check-in: 630cfacdfe user: vdh tags: mksh
|
| | |
Changes
Deleted sdcmd.
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
|
#!/usr/bin/env bash
#
#name: sdcmd
#depends: sd.ksh
#
#for use with tcsh alias defined as "alias cd 'eval `sdcmd \!*`'".
#if called from `tcsh', quote `=num'-type arguments to prevent interpretation
#as a tcsh dirstack entry (i.e. use `\=num').
sdlines=512
sdmax=8192
[[ . sd.ksh ]] || exit 1
if [[ $? != 0 ]]; then
#something is wrong. we try to do simple cd and exit this script.
if [[ -d "$*" ]] || [[ "$*" == "" ]] || [[ "$*" == "-" ]]; then
echo chdir $*
else
echo "echo $*: no such directory."
fi
return #important...
fi
#we want this script to behave as closely as possible as the tcsh builtin
#`cd' does since it's probably aliased to that command as shown above.
#therfore, we go to the trouble to parse command line args.
#we simply ignore them, though.
opt=""
while getopts plvn var; do
if [[ "$var" == p ]]; then
opt="${opt} -p"
echo "${0##*/}: option -p ignored" >&2
elif [[ "$var" == l ]]; then
opt="${opt} -l"
echo "${0##*/}: option -l ignored" >&2
elif [[ "$var" == n ]]; then
opt="${opt} -n"
echo "${0##*/}: option -n ignored" >&2
elif [[ "$var" == v ]]; then
opt="${opt} -v"
echo "${0##*/}: option -v ignored" >&2
fi
done
shift $((OPTIND - 1))
#always execute `sd' to enforce update of $dirv and suppress
#any messages (either errors or from `cd -'), since the present
#script must output only the intended `cd command').
#do this in a subshell in order to prevent actual cd action!
#
(sd "$*" > /dev/null 2> /dev/null; sdlogappend)
#look up the name (a second time since we don't get it out of
#the previous `sd' call...)
#
dname=$(sdname "$*")
dname=${dname/%$'\n'*}
#note that we use `chdir' instead of `cd' in order to prevent
#recursion when defining the tcsh alias for `cd'.
#tcsh crashes during eval if the `cd' is not successful, so we test again.
if [[ -d "$dname" ]]; then
echo "chdir \"$dname\""
elif [[ $dname == "-" ]]; then
echo chdir $dname
else
echo "echo $dname: no such directory."
fi
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
|