10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-12 22:24:41 +02:00

Error in bash script

This commit is contained in:
Anthony Scemama 2015-09-22 09:07:34 +02:00
parent 13ce974ee4
commit 8731ba6748
2 changed files with 17 additions and 11 deletions

View File

@ -8,6 +8,8 @@
# Prints in stdout the name of a temporary file containing the basis set. # Prints in stdout the name of a temporary file containing the basis set.
# #
if [[ -z ${QP_ROOT} ]] if [[ -z ${QP_ROOT} ]]
then then
print "The QP_ROOT environment variable is not set." print "The QP_ROOT environment variable is not set."
@ -15,6 +17,7 @@ then
exit -1 exit -1
fi fi
export EMSL_API_ROOT="${QP_ROOT}"/install/emsl export EMSL_API_ROOT="${QP_ROOT}"/install/emsl
tmpfile="$1" tmpfile="$1"

View File

@ -4,6 +4,9 @@
# directory, where xxx is the corresponding mo_label. # directory, where xxx is the corresponding mo_label.
# Wed Apr 2 14:35:15 CEST 2014 # Wed Apr 2 14:35:15 CEST 2014
set -u # Crashes if a variable is uninitialized
set -e # Exits if any statement returns a non-true return value
if [[ -z ${QP_ROOT} ]] if [[ -z ${QP_ROOT} ]]
then then
print "The QP_ROOT environment variable is not set." print "The QP_ROOT environment variable is not set."
@ -11,40 +14,40 @@ then
exit -1 exit -1
fi fi
EZFIO=$1 EZFIO="$1"
if [[ -z ${EZFIO} ]] if [[ -z "${EZFIO}" ]]
then then
echo "Error in $0" echo "Error in $0"
exit 1 exit 1
fi fi
if [[ ! -f ${EZFIO}/mo_basis/mo_label ]] if [[ ! -f "${EZFIO}/mo_basis/mo_label" ]]
then then
LABEL='no_label' LABEL='no_label'
else else
LABEL=$(head -1 ${EZFIO}/mo_basis/mo_label) LABEL=$(head -1 "${EZFIO}/mo_basis/mo_label")
fi fi
DESTINATION="save/mo_basis/${LABEL}" DESTINATION="save/mo_basis/${LABEL}"
cd ${EZFIO} cd "${EZFIO}"
if [[ ! -d save/mo_basis ]] if [[ ! -d save/mo_basis ]]
then then
mkdir -p save/mo_basis mkdir -p save/mo_basis
fi fi
BACKUP=${DESTINATION}.old BACKUP="${DESTINATION}.old"
if [[ -d ${BACKUP} ]] if [[ -d "${BACKUP}" ]]
then then
rm -rf ${BACKUP} rm -rf "${BACKUP}"
fi fi
if [[ -d ${DESTINATION} ]] if [[ -d "${DESTINATION}" ]]
then then
mv ${DESTINATION} ${BACKUP} mv "${DESTINATION}" "${BACKUP}"
fi fi
cp -r mo_basis ${DESTINATION} cp -r mo_basis "${DESTINATION}"