A simple bash script that can set a cookie when executed via web :
#!/bin/bash
echo "Set-Cookie: eee=1"
echo "Content-type: text/html"
echo ""
echo "test"
I replaced the entire codes above with the following:
#!/usr/bin/env python
import os
print 'Set-Cookie: eee=1'
print 'Content-Type: text\n'
print '<html><body>'
a = os.environ.get('HTTP_COOKIE')
print a
print '</body></html>'
this one can now both set and retrieve a cookie.
but it is no longer a bash script. it is a python script.
the question is.. how to retrieve the cookie via bash script itself.. ?
echo $VARIABLE
does not print the value of the variable, it does further processing. – Gilles 'SO- stop being evil' Sep 02 '14 at 22:16