Skip to content

Commit

Permalink
Add clear error for when date command does not have nanos support
Browse files Browse the repository at this point in the history
  • Loading branch information
ScoreUnder committed May 2, 2020
1 parent 528ef7a commit 23a75f7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions S3/S3_Transfer_Acceleration/Bash-script/test-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ if command -v gdate >/dev/null; then
date() { command gdate "$@"; }
fi

nanos_test=$(date +%N)
if [ "${nanos_test%N}" != "$nanos_test" ]; then
{
echo '`date` command does not support nanoseconds.'
echo 'If you are on Mac OS, please install coreutils via homebrew.'
exit 1
} >&2
fi

# Taking Input parameters from the user
read -p "Enter the local path of the file you want to upload: " filename
read -p "Enter the destination file name: " s3_filename
Expand Down

0 comments on commit 23a75f7

Please sign in to comment.