#!/usr/bin/env bash #----------------------------------------------------------------------- # OPTARG: ruser@rhosr:rdir # # to be sourced, returns RDIR, RHOST, RUSER # JOB_OUTPUT_DIR #----------------------------------------------------------------------- P1=$1 debug_script=$2 export rdir=`echo $P1 | sed 's/:/ /g' | awk '{print $2}'` # echo RDIR=$RDIR if [ .$rdir == "." ] ; then # syntax "-o a:" forbidden # local output dir redefined export JOB_OUTPUT_DIR=$OPTARG else # request to move output # into remote directory # when the job finishes export rhost=`echo $P1 | sed 's/:/ /g' | awk '{print $1}'` # echo RHOST=$RHOST if [ .$rhost == ."caf" ] ; then rhost=$CAFOUT_NODE if [ .$rdir != "." ] ; then rdir=${CAFOUT_SCRATCHPATH}/${RDIR} fi # echo .............RHOST:RDIR: ${RHOST}:${RDIR} else if [ ."`echo $rhost | grep @`" != "." ] ; then # user@host export ruser=`echo $rhost | awk -F @ '{print $1}'` export rhost=`echo $rhost | awk -F @ '{print $2}'` else export ruser=$user fi if [ .$debug_script != "." ] ; then echo [parse_output_dir]: ruser=$ruser ; rhost=$rhost fi fi fi OP1=$ruser OP2=$rhost OP3=$rdir if [ .$debug_script != "." ] ; then echo [parse_output_dir]: OP1=$OP1 echo [parse_output_dir]: OP2=$OP2 echo [parse_output_dir]: OP3=$OP3 fi