Subject: Re: bash like array in ksh? or alt?
To: None <netbsd-users@netbsd.org>
From: George Georgalis <george@galis.org>
List: netbsd-users
Date: 01/15/2007 23:16:32
On Mon, Jan 15, 2007 at 10:25:25PM -0500, George Georgalis wrote:
>I need to run something like this bash code in
>.profile for ksh.

I almost figured it out....

# ~/.profile
# ...
# following are only for interactive sessions
# case $- in *i*)
/usr/bin/tty -s || return

if [ -z "$SSH_AGENT_ENV" ]; then
 if [ -f ~/.ssh/id_dsa -o -f ~/.ssh/id_rsa  -o -f ~/.ssh/identity ]; then
  printf "${USER}@$(hostname): "
  eval $(ssh-agent)
  export SSH_AGENT_ENV="SSH_AGENT_PID $SSH_AGENT_PID SSH_AGENT_TOP_PID $$"
  ssh-add || { kill $SSH_AGENT_PID ; unset SSH_AGENT_PID SSH_AGENT_ENV ;}
 fi
fi


# ~/.logout
[ -n "$SSH_AGENT_ENV" ] && set $SSH_AGENT_ENV \
        [ "$$" = "$4" ] && kill $2 && echo killed ssh-agent $2 \
        || echo ${0} : ssh-agent already died?' 2>/dev/stderr ; exit 1


however, ksh does not source ~/.logout or any other file I can see
on exit! is there any glue to make this work?

// George


-- 
George Georgalis, systems architect, administrator <IXOYE><