Last active
January 24, 2020 19:16
-
-
Save hazcod/da9ec610c3d50ebff7dd5e7cac76de05 to your computer and use it in GitHub Desktop.
UrlEncode function in Bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this in your .bashrc or .bash_profile | |
function urlencode(){ | |
[ -z "$1" ] || echo -n "$@" | 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
@yrro: Thanks, but this seems to give me something weird on macos: