Check parameters for empty or '-' contents
This commit is contained in:
parent
b516d7889e
commit
91d1f71624
11
cfddns.sh
11
cfddns.sh
@ -45,6 +45,17 @@ while getopts ':f:r:' PARAMS; do
|
||||
esac
|
||||
done
|
||||
|
||||
# Check validity of parameters
|
||||
if [ -z "$accountFile" ] || [[ $accountFile == -* ]]; then
|
||||
echo -e "\e[1;31mNo file containing account details was specified."
|
||||
echo -e "\e[0;31m(-f parameter empty or missing)\e[0m"
|
||||
exit 101
|
||||
elif [ -z ${dnsRecords} ]; then
|
||||
echo -e "\e[1;31mNo DNS records were specified."
|
||||
echo -e "\e[0;31m(-r parameter(s) empty or missing)\e[0m"
|
||||
exit 102
|
||||
fi
|
||||
|
||||
|
||||
### Echo results (testing)
|
||||
echo "Based on parameters provided:"
|
||||
|
Loading…
Reference in New Issue
Block a user