Comment détecter que le shell a été sourcé
Par krusaf le vendredi, mars 16 2007, 19:52 - Programmation - Lien permanent
Par sourcer j'entends:
. script.sh
ou
source script.sh
Comme ça :
if [ "$0" != "-bash" ]
then
echo "Please execute the program like that : . init.sh or source init.sh"
exit 1
fi




clics


visiteurs uniques