hash2magnet.sh 269 B

1234567891011121314
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. display_help() {
  4. echo "Usage: ${0##*/} [hash/es]"
  5. echo "Scripts converts hash to magnetlink"
  6. exit 2
  7. }
  8. [[ $# -lt 1 ]] && display_help
  9. for hash in "$@"; do
  10. echo "magnet:?xt=urn:btih:${hash}"
  11. done