Prefer ksh specific features

master
Adolfo Perez Alvarez 9 months ago
parent 7a85d24714
commit 94787ac0f5

@ -1,5 +1,4 @@
#!/bin/ksh
diralias()
function diralias
{
typeset -i i
case $# in
@ -13,15 +12,15 @@ diralias()
;;
1)
let i=0
while [[ i -lt ${#DIRALIASNAM[@]} && $1 != ${DIRALIASNAM[i]} ]]
while [[ $i -lt ${#DIRALIASNAM[@]} && $1 != ${DIRALIASNAM[i]} ]]
do
let i++
done
(( i == ${#DIRALIASNAM[@]} )) && echo $1 || echo ${DIRALIASVAL[i]}
(( i == ${#DIRALIASNAM[@]} )) && print $1 || print ${DIRALIASVAL[i]}
;;
2)
let i=0
while [[ i -lt ${#DIRALIASNAM[@]} && $1 != ${DIRALIASNAM[i]} ]]
while [[ $i -lt ${#DIRALIASNAM[@]} && $1 != ${DIRALIASNAM[i]} ]]
do
let i++
done

9
j

@ -1,11 +1,10 @@
#!/bin/ksh
j()
function j
{
local da
typeset da
da=$(diralias $1)
if echo $da | grep '^!' >/dev/null
if print $da | grep '^!' >/dev/null
then
if ! da=$(eval $(echo "$da" | sed 's/^!//') 2>/dev/null)
if ! da=$(eval $(print "$da" | sed 's/^!//') 2>/dev/null)
then
return 65
fi

@ -1,15 +1,15 @@
function jmod
{
(( $# != 1 )) && return 64
local m=$(jr && pwd)/modules/apps
local d=$(find $m -maxdepth 2 -mindepth 2 -type d -iregex ".*/.*$1$")
typeset m=$(jr && pwd)/modules/apps
typeset d=$(find $m -maxdepth 2 -mindepth 2 -type d -iregex ".*/.*$1$")
[[ -z $d ]] && return 1
if [[ $(echo $d | wc -w) > 1 ]]
if (( $(print $d | wc -w) > 1 ))
then
select d in $d
do
break
done
fi
echo ${d##*/} && cd $d
print ${d##*/} && cd $d
}

Loading…
Cancel
Save