diralias, j - Directory aliases and quick directory navigation
This commit is contained in:
parent
9cffb845c4
commit
8e49bcb05d
32
diralias
Normal file
32
diralias
Normal file
@ -0,0 +1,32 @@
|
||||
function diralias
|
||||
{
|
||||
typeset -i i=0
|
||||
|
||||
case $# in
|
||||
0)
|
||||
while (( i < ${#DIRALIASNAM[@]} ))
|
||||
do
|
||||
printf "%s\t%s\n" ${DIRALIASNAM[i]} "${DIRALIASVAL[i]}"
|
||||
let i++
|
||||
done
|
||||
;;
|
||||
1)
|
||||
while [[ $i -lt ${#DIRALIASNAM[@]} && $1 != ${DIRALIASNAM[i]} ]]
|
||||
do
|
||||
let i++
|
||||
done
|
||||
(( i == ${#DIRALIASNAM[@]} )) && print $1 || print ${DIRALIASVAL[i]}
|
||||
;;
|
||||
2)
|
||||
while [[ $i -lt ${#DIRALIASNAM[@]} && $1 != ${DIRALIASNAM[i]} ]]
|
||||
do
|
||||
let i++
|
||||
done
|
||||
DIRALIASNAM[i]=$1
|
||||
DIRALIASVAL[i]="$2"
|
||||
;;
|
||||
*)
|
||||
exit 64
|
||||
;;
|
||||
esac
|
||||
}
|
Loading…
Reference in New Issue
Block a user