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/16/2007 00:07:48
On Mon, Jan 15, 2007 at 11:16:32PM -0500, George Georgalis wrote:
>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

here we go!

 # tail -n12 .profile .ksh_logout  
==> .profile <==
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`
  ssh-add \
        && export SSH_AGENT_ENV="SSH_AGENT_PID $SSH_AGENT_PID SSH_AGENT_TOP_PID $$" \
        || { kill $SSH_AGENT_PID ; unset SSH_AGENT_PID ;}
 fi
fi
if [[ -r ~/.ksh_logout ]]; then
 trap '. ~/.ksh_logout' EXIT
fi 

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


thanks to http://www.sunmanagers.org/archives/1995/1155.html

// George


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