Skip to content

Instantly share code, notes, and snippets.

View Emkas's full-sized avatar

Emil Sierżęga Emkas

  • Poland
  • 05:49 (UTC +01:00)
View GitHub Profile
@Emkas
Emkas / cas-get.sh
Last active July 18, 2023 13:07 — forked from mgrRaf/cas-get.sh
Trim whitespace in CURL_DEST.
#!/bin/bash
# Usage: cas-get.sh {url} {username} {password} # If you have any errors try removing the redirects to get more information
# The service to be called, and a url-encoded version (the url encoding isn't perfect, if you're encoding complex stuff you may wish to replace with a different method)
DEST="$1"
ENCODED_DEST=`echo "$DEST" | perl -p -e 's/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg' | sed 's/%2E/./g' | sed 's/%0A//g'`
#IP Addresses or hostnames are fine here
CAS_HOSTNAME=galaxy:9143