Merge pull request #32 from bhuvi8/master

display usage info if required args not passed
This commit is contained in:
Laurent Cozic
2016-02-03 17:22:48 +01:00
2 changed files with 10 additions and 1 deletions
+1
View File
@@ -1,2 +1,3 @@
.idea
test.sh
*~
+8
View File
@@ -31,6 +31,9 @@ trap 'fn_terminate_script' SIGINT
# -----------------------------------------------------------------------------
# Small utility functions for reducing code duplication
# -----------------------------------------------------------------------------
fn_display_usage() {
fn_log_info "Usage : $(basename $0) <source> <[user@host:]destination> [exclude-pattern-file]"
}
fn_parse_date() {
# Converts YYYY-MM-DD-HHMMSS to YYYY-MM-DD HH:MM:SS and then to Unix Epoch.
@@ -110,6 +113,11 @@ SSH_DEST_FOLDER=""
SSH_CMD=""
SSH_FOLDER_PREFIX=""
#display usage information if required arguments are not passed
if [[ "${#@}" -lt 2 ]]; then
fn_display_usage
exit 1
fi
SRC_FOLDER="${1%/}"
DEST_FOLDER="${2%/}"
EXCLUSION_FILE="$3"