diff --git a/.bashrc.d/11-functions.bashrc b/.bashrc.d/11-functions.bashrc index 14e8da6..d35e285 100644 --- a/.bashrc.d/11-functions.bashrc +++ b/.bashrc.d/11-functions.bashrc @@ -617,10 +617,16 @@ gdrivedl() { local _ID=$1 local _FILENAME=$2 + if [[ -z "$XDG_DOWNLOAD_DIR" ]]; then + mkdir $HOME/Downloads + local _XDG_DOWNLOAD_DIR="$HOME/Downloads" + else + local _XDG_DOWNLOAD_DIR="$XDG_DOWNLOAD_DIR" + fi wget --prefer-family=IPv4 --force-directories --no-check-certificate --no-hsts --continue --load-cookies "/tmp/gdrive-cookies-${_ID}.txt" \ "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/gdrive-cookies-${_ID}.txt \ --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=${_ID}' -O- | \ - sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=${_ID}" -O "${XDG_DOWNLOAD_DIR}/$_FILENAME" \ + sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=${_ID}" -O "${_XDG_DOWNLOAD_DIR}/$_FILENAME" \ && rm -rf "/tmp/gdrive-cookies-${_ID}.txt" }