#!/bin/bash

out=${out:-~} outfs=( .bashrc .profile ) me=$BASH_SOURCE medir=${me%/*} c1=$medir/../xbl5 foundxbl= C=( ) D=( ) \
match=xblpath=
shopt -s extglob

for c in ${xblhere:+"$xblhere"} "${@:-"$c1" "$medir/ps1x"}" ; do
 [[ ! -e $c ]] && continue

 if [[ $foundxbl ]] ; then
  C+=( "$c" )
 else
  if [[ $c == ?(*/)xbl.bash ]] ; then
   foundxbl=$c
  else
   if [[ -e $c/xbl ]] ; then
    foundxbl=$c/xbl
   else
    D+=( "$c" )
   fi
  fi
 fi
done

if [[ ! $foundxbl ]] ; then
 printf 'xblinst: sorry cant find xbl, please specify xblhere=path to it to this script\n'
else
 xblpath=( "$foundxbl" "${D[@]}" "${C[@]}" )
 res=$'\n('${xblpath[@]@Q}') && . "${xblpath[@]}"\n\n'
 

