Return $var ne fonctionne pas ?
Salut,
j'ai un script (appelé par un autre script) qui a été a l'orgine écrit pour UNIX mais qui doit fonctionner sous linux. Tout fonctionne très bien sauf la derniere ligne du script qui a pour but de retourner le code retour de l'exécution.
voici mon script :
Code:
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 42 43 44 45
|
ret_status=0
#
# Control # parameters
# --------------------
p1=${1}
if [ -r $p1/universe ]
then
echo ""
else
mkdir $p1/universe
if [ $? -ne 0 ]
then
echo $mess7
ret_status=1
fi
chmod 0777 $p1/universe
if [ $? -ne 0 ]
then
echo $mess7
ret_status=1
fi
mkdir $p1/universe/config
chmod 0777 $p1/universe/config
if [ $? -ne 0 ]
then
echo $mess7
ret_status=1
fi
touch $p1/universe/config/uxsrsrvkmu.sck
chmod 777 $p1/universe
chmod 777 $p1/universe/config
chmod 644 $p1/universe/config/*
fi
# Droits des fichiers
#------------------------------------------
chmod 744 $p1/lib/knowledge/DOLLAR_UNIVERSE.kml
chmod 744 $p1/lib/knowledge/UNI_*.*
chmod 744 $p1/lib/psl/UNI_*.*
chmod 744 $p1/bin/UNI_*
return $ret_status |
L'erreur se situe au niveau du return, j'ai :
Citation:
return: can only `return' from a function or sourced script
Echec de l'installation
Je ne m'y connais absolument pas sous linux, et je ne sais pas ce que je dois faire, l'idéal étant que ça fonctionne a la fois sous linux et unix.
merci d'avance :D [/code]