Skip to content

Instantly share code, notes, and snippets.

@fijimunkii
Created October 13, 2017 17:08
Show Gist options
  • Save fijimunkii/d56c9859b9e307c684007d8f1932ed79 to your computer and use it in GitHub Desktop.
Save fijimunkii/d56c9859b9e307c684007d8f1932ed79 to your computer and use it in GitHub Desktop.
bash uri encode
#!/usr/bin/env bash
# https://stackoverflow.com/a/7506695/2474735
set -e
set -u
set -o pipefail
echo `echo -ne "$1" | hexdump -v -e '/1 "%02x"' | sed 's/\(..\)/%\1/g'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment