Commit b6fdcb8f authored by Luiza Wille's avatar Luiza Wille

Issue #72: created treatment to wrong inputs

Signed-off-by: Luiza Wille's avatarLuiza Wille <lmwc14@inf.ufpr.br>
parent 8ebb4f65
File mode changed from 100755 to 100644
......@@ -30,6 +30,25 @@
user=$3
passwd=$4
# Treating the cases where the year input is invalid
if [[ "${#year}" != "4" ]]; then
echo " Year is invalid. Please enter a 4 digit year."
echo " Example: $0 2016 12 myuser mypass all"
exit
fi
# Treating the case where month is too big
if [[ "${#month}" -gt "2" ]]; then
echo " Month is invalid. Please enter a 2 digit month."
echo " Example: $0 2016 12 myuser mypass all"
exit
fi
# Treating the case where the user uses only 1 digit to the month value
if [[ "${#month}" -eq "1" ]]; then
month="0$month"
fi
source ./config.sh
# Check if all variables in config file are set:
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -20,6 +20,25 @@ user=$3
passwd=$4
insertions=$5
# Treating the cases where the year input is invalid
if [[ "${#year}" != "4" ]]; then
echo " Year is invalid. Please enter a 4 digit year."
echo " Example: $0 2016 12 myuser mypass all"
exit
fi
# Treating the case where month is too big
if [[ "${#month}" -gt "2" ]]; then
echo " Month is invalid. Please enter a 2 digit month."
echo " Example: $0 2016 12 myuser mypass all"
exit
fi
# Treating the case where the user uses only 1 digit to the month value
if [[ "${#month}" -eq "1" ]]; then
month="0$month"
fi
if [[ "$insertions" == "all" || "$insertions" == "expenses" ]]; then
# First, insert Expenses data.
echo "Inserting Expenses from ${year}-${month}..."
......
File mode changed from 100755 to 100644
......@@ -29,6 +29,25 @@ month=$2
user=$3
passwd=$4
# Treating the cases where the year input is invalid
if [[ "${#year}" != "4" ]]; then
echo " Year is invalid. Please enter a 4 digit year."
echo " Example: $0 2016 12 myuser mypass all"
exit
fi
# Treating the case where month is too big
if [[ "${#month}" -gt "2" ]]; then
echo " Month is invalid. Please enter a 2 digit month."
echo " Example: $0 2016 12 myuser mypass all"
exit
fi
# Treating the case where the user uses only 1 digit to the month value
if [[ "${#month}" -eq "1" ]]; then
month="0$month"
fi
source ./config.sh
# Check if all variables in config file are set:
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -33,7 +33,27 @@ month=$2
user=$3
passwd=$4
# Treating the cases where the year input is invalid
if [[ "${#year}" != "4" ]]; then
echo " Year is invalid. Please enter a 4 digit year."
echo " Example: $0 2016 12 myuser mypass all"
exit
fi
# Treating the case where month is too big
if [[ "${#month}" -gt "2" ]]; then
echo " Month is invalid. Please enter a 2 digit month."
echo " Example: $0 2016 12 myuser mypass all"
exit
fi
# Treating the case where the user uses only 1 digit to the month value
if [[ "${#month}" -eq "1" ]]; then
month="0$month"
fi
source ./config.sh
configFile='scripts/workers/config.sh'
if [ -z "${index}" ]; then
inputError "index" $configFile
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment