A one liner to parse a http query string in bash
# | |
# the following one liner creates a shell variable from every parameter in a | |
# the query string in the variable QUERY, of the form p1=v1&p2=v2,... and sets it to | |
# the corresponding value so that parameters can be accessed by its name $p1, $p2, ... | |
# | |
for p in ${QUERY//&/ };do kvp=( ${p/=/ } ); k=${kvp[0]};v=${kvp[1]};eval $k=$v;done |
This comment has been minimized.
This comment has been minimized.
What about |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.