1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| function f_calculnomf00 {
argument=$1
argument2=$2
nbz=$(echo $argument | awk ' { i=split($0,s,"/" ); print i;}') # controle path complet ou uniquement nom du fichier
if [ ${nbz} -eq 1 ]; then # argument = uniquement nom du fichier
extent=$(echo $argument | awk ' { i=split($0,s,"." ); print i;}'); # test nom fichier sans extension
if [ ${extent} -gt 1 ]; then
argument3=$(echo $argument | awk ' { i=split($0,s,"." ); print s[1];}');
else
argument3=$argument;
fi
carad=$(echo $argument3 | awk ' { lg=length($0); i=substr($0,lg-1,1); print i;}')
card=$(echo $argument3 | awk ' { lg=length($0); i=substr($0,lg-1,2); print i;}')
chemin="";
calculOK='';
if [ ${card} = 'BP' ] || [ ${card} = 'TS' ] || [ ${card} = 'TT' ] || [ ${card} = 'FV' ] || [ ${carad} = 'P' ] || [ ${carad} = 'X' ] || [ ${carad} = 'D' ] || [ ${carad} = 'I' ] || [ ${carad} = '1' ] || [ ${carad} = 'A' ]; then
chemin=$X8_FICH_PERM; calculOK=O;
if [ ${extent} -eq 1 ]; then # test generation automatique extension
if [ ${argument2} = "R" ]; then argument=${argument}".0"; else argument=${argument}".tmp"; fi
fi
elif [ ${carad} = 'E' ] || [ ${carad} = 'T' ] || [ ${carad} = 'U' ]; then chemin=$X8_FICH_TMP_SAV; calculOK='O';
elif [ ${carad} = 'V' ]; then chemin=$X8_FICH_TMP_NOSAV; calculOK='O';
elif [ ${carad} = '0' ]; then chemin=$X8_FICH_PARAM; calculOK='O';
elif [ ${carad} = 'F' ] || [ ${carad} = 'W' ] || [ ${carad} = 'Y' ]; then chemin=$X8_FICH_TRANSF; calculOK='O';
elif [ ${carad} = 'R' ]; then chemin=$X8_FICH_INT_APP_ENT; calculOK='O';
elif [ ${carad} = 'Z' ] && [ ${argument2} = "R" ]; then chemin=$X8_FICH_INT_APP_ENT; calculOK='O';
elif [ ${carad} = 'Z' ]; then chemin=$X8_FICH_INT_APP_SOR; calculOK='O';
elif [ ${carad} = 'K' ]; then chemin=$X8_FICH_ORACLE; calculOK='O';
elif [ ${carad} = 'L' ]; then chemin=$X8_SAS_UG; calculOK='O';
else chemin=""
fi
if [ "${calculOK}" = 'O' ]; then
if [ "${chemin}" != "" ]; then echo $LMDATA"/"${chemin}"/"${argument}; else echo $LMDATA"/"${argument}; fi
else
export RETCODE=1;
fi
else echo $1
fi
} |
Partager