Correct script for multiple get
This commit is contained in:
parent
5b1b8cb614
commit
862a511b3a
16
scripts/up
16
scripts/up
@ -7,8 +7,7 @@ set -euo pipefail
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
# Curl function to be used
|
# Curl function to be used
|
||||||
CURL="curl"
|
CURL=("curl")
|
||||||
DEFAULT_ARGS_CURL=()
|
|
||||||
|
|
||||||
# Defaults field to use. If equal to $UNSET will be oncsiedered as no set
|
# Defaults field to use. If equal to $UNSET will be oncsiedered as no set
|
||||||
URLPATH="/up"
|
URLPATH="/up"
|
||||||
@ -77,9 +76,9 @@ fi
|
|||||||
|
|
||||||
function check_prerequisite()
|
function check_prerequisite()
|
||||||
{
|
{
|
||||||
if ! command -v $CURL &> /dev/null
|
if ! command -v ${CURL[0]} &> /dev/null
|
||||||
then
|
then
|
||||||
echo -e "${ROUGE}ERROR${STOPC}: $CURL could not be found."
|
echo -e "${ROUGE}ERROR${STOPC}: ${CURL[0]} could not be found."
|
||||||
echo "Aborting"
|
echo "Aborting"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
@ -227,7 +226,9 @@ then
|
|||||||
[ ! "$GETPATH" = "$UNSET" ] && FULLURL+="$GETPATH"
|
[ ! "$GETPATH" = "$UNSET" ] && FULLURL+="$GETPATH"
|
||||||
FULLURL+="/$USERNAME/$FPATH"
|
FULLURL+="/$USERNAME/$FPATH"
|
||||||
[ ! "$GETPATHSUFFIX" = "$UNSET" ] && FULLURL+="$GETPATHSUFFIX"
|
[ ! "$GETPATHSUFFIX" = "$UNSET" ] && FULLURL+="$GETPATHSUFFIX"
|
||||||
ARGS+=("$FULLURL")
|
|
||||||
|
[ $VERB -gt 0 ] && echo "> $CURL ${ARGS[@]} $FULLURL -o $FPATH"
|
||||||
|
${CURL[@]} ${ARGS[@]} $FULLURL -o $FPATH
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
# Default args
|
# Default args
|
||||||
@ -244,7 +245,8 @@ else
|
|||||||
FULLURL="$URL"
|
FULLURL="$URL"
|
||||||
[ ! "$URLPATH" = "$UNSET" ] && FULLURL+="$URLPATH"
|
[ ! "$URLPATH" = "$UNSET" ] && FULLURL+="$URLPATH"
|
||||||
ARGS+=("$FULLURL")
|
ARGS+=("$FULLURL")
|
||||||
|
|
||||||
|
[ $VERB -gt 0 ] && echo "> $CURL ${ARGS[@]}"
|
||||||
|
${CURL[@]} ${ARGS[@]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ $VERB -gt 0 ] && echo "> $CURL ${ARGS[@]}"
|
|
||||||
$CURL ${ARGS[@]} ${DEFAULT_ARGS_CURL[@]}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user