Skip to content

Commit 23a75f7

Browse files
committed
Add clear error for when date command does not have nanos support
1 parent 528ef7a commit 23a75f7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

S3/S3_Transfer_Acceleration/Bash-script/test-upload.sh

+9
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ if command -v gdate >/dev/null; then
3535
date() { command gdate "$@"; }
3636
fi
3737

38+
nanos_test=$(date +%N)
39+
if [ "${nanos_test%N}" != "$nanos_test" ]; then
40+
{
41+
echo '`date` command does not support nanoseconds.'
42+
echo 'If you are on Mac OS, please install coreutils via homebrew.'
43+
exit 1
44+
} >&2
45+
fi
46+
3847
# Taking Input parameters from the user
3948
read -p "Enter the local path of the file you want to upload: " filename
4049
read -p "Enter the destination file name: " s3_filename

0 commit comments

Comments
 (0)