Working with Query Strings
As an alternative to processing form data, you can work with raw query strings in your shell CGI programs. When you execute a script from the shell prompt, the arguments passed to the script are made available in numbered environment variables. The first argument to the script is stored in $1, the second in $2, and so on. The query string in a request for a CGI program is passed to that program as a command-line parameter. So, if you request the URL http://localhost/cgi-bin/test.sh?foo, the $1 variable will be set to foo.
Sending multiple arguments is easy, too. All you have to do is separate each argument with a space. You can URL-encode the spaces in one of two ways. Web servers will convert plusses into spaces. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access