-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshellInsert.sh
More file actions
29 lines (27 loc) · 917 Bytes
/
shellInsert.sh
File metadata and controls
29 lines (27 loc) · 917 Bytes
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
#!/bin/sh
#when using "cd path", instead alias to shellInsert so we get shellInsert path
#alias cd='. ./shellFind.sh'
#alias jp='. ./shellInsert.sh'
#Insert does the actual `cd-ing` all the cds in find call on insert
#Insert avoids hashing .. or . because those don't always map to the same directory
#Insert determines if the argument is an existing directory. If yes, then cd to
#it and hash it. If not, then try to cd to it. Insert is also used in find
Insert(){
myjpInsertKey=$1
myjpclasspath="/home/user/cdProject/hashCode/dict"
#if directory exists, add it to hash
if [ "$myjpInsertKey" == ".." -o "$myjpInsertKey" == "." ];
then
builtin cd $myjpInsertKey
else
if [ -d $myjpInsertKey ]
then
builtin cd $myjpInsertKey
myjpInsertVal=`pwd`
java -classpath $myjpclasspath JPInsert $myjpInsertKey $myjpInsertVal
else
builtin cd $myjpInsertKey
fi
fi
}
Insert $1