Test if the given variable contains a valid directory. If not, exit. (This uses the eval function of the shell)
testdirvar () {
tmp=$1
if [ -d "${!tmp}" ] ; then
echo "${tmp}=${!tmp} (variable ${tmp}: directory exists)"
else
echo "!!! ${tmp}=${!tmp} is not a directory (variable ${tmp}) !!!"
exit
fi
}
Aucun commentaire:
Enregistrer un commentaire