Hi all,
I'd like to be able to call a script via a browser or via the CLI/shell and have that script 'know' what’s calling it. Also, and more importantly, I’d like for the script to be able to pick up arguments of the form option (i.e. like a simple command-line switch) or option=value ; for instance:
In browser via url:
http://.../script.pl?option1&option2&option3=value3
In CLI:
script.pl option1 option2 option3=value3
I've tried this with CGI and @ARGS but the way either handles switches or assignments is inconsistent and I haven't been able to tell programatically what's calling it.
Cheers
In reply to Telling if your script is running from web page or CLI by dizzyg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |