1234567891011121314151617181920212223242526 |
- #!/usr/bin/env bash
- ssh_server="bryanroessler.com"
- ssh_files_path="/var/www/repos.bryanroessler.com/files"
- www_files_path="https://repos.bryanroessler.com/files"
- if [[ "$#" -lt 1 ]]; then
- echo "You must provide at least one argument"
- exit 1
- fi
- for file in "$@"; do
- fname="${file##*/}"
- random32=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 32 | head -n 1)
- rsync -a "${file}" "${ssh_server}:${ssh_files_path}/${random32}/"
- links_array+=("$www_files_path/${random32}/$fname")
- done
- if [[ "${#links_array[@]}" == 1 ]]; then
- printf '%s' "${links_array[@]}" | wl-copy
- else
- printf '%s\n' "${links_array[@]}" | wl-copy
- fi
- exit $?
|