printf "%s: version %s\n" "$weAreKnownAs" "$version"
printf "Part of s3-bash. Latest version is at %s\n" 'http://code.google.com/p/s3-bash/'
printf "Usage %s: -h\n" "$weAreKnownAs"
- printf "Usage %s: [-vS] [-H file] [-a file] -k key -s file -T file url\n" "$weAreKnownAs"
+ printf "Usage %s: [-vS] [-H file] [-a file] [-b speed] -k key -s file -T file url\n" "$weAreKnownAs"
printf " Option\tType\tRequirement\tDescription\n"
printf " -h\t\tprecedent\tprint this help\n"
printf " -v\t\toptional\tverbose output\n"
printf " -S\t\toptional\tUse https\n"
printf " -H\tfile\toptional\tFile to write response headers to\n"
printf " -a\tfile\toptional\tFile to read Amazon custom headers from (X-Amz-Date is not allowed)\n"
+ printf " -b\tspeed\toptional\tBandwidth limit in units/sec\n"
printf " -c\tMIME\toptional\tMIME Content type. Default is text/plain\n"
printf " \turl\tmandatory\trelative url including bucket name and leading slash, eg /bucket/path/to/object?acl. Assumed to be already encoded\n"
printf "\n"
fileToUpload=""
dumpHeaderFile="/dev/null"
amazonHeaderFile="/dev/null"
+ bwlimit=""
contentType="text/plain"
while getopts "hvk:s:SH:T:a:c:" optionName; do
case "$optionName" in
H) dumpHeaderFile="$OPTARG";;
T) fileToUpload="$OPTARG";;
a) amazonHeaderFile="$OPTARG";;
+ b) bwlimit="--limit-rate $OPTARG";;
c) contentType="$OPTARG";;
[?]) printErrorHelpAndExit "Option not recognised" $userSpecifiedDataErrorExitCode;;
esac
readonly verb="PUT"
if [ ! "-" = "$fileToUpload" ]; then
readonly contentMD5="$(base64EncodedMD5 "$fileToUpload")"
- readonly verbToPass="-T \"$fileToUpload\""
+ readonly verbToPass="-T \"$fileToUpload\" $bwlimit"
else
readonly contentMD5=""
- readonly verbToPass="-T -"
+ readonly verbToPass="-T - $bwlimit"
fi
}