Riley Willow Riley Willow - 2 years ago 83
Bash Question

Sending argument from CGI script as bash script argument

I am trying to pass the argument to my bash script through my cgi script. This may sound a little bit confusing, so here is the explanation,

I have bash script called
which accept one argument lets say

so I execute this script like this,

bash myName

The name is then written in a text file, and then i can read it from that text file.

Which works just fine, but I want to be able to execute this same command through cgi, so I did this inside my cgi file,

`/bin/echo "bash myName"`;

Now I execute this cgi script through my webserver like this,


is not passing as an argument to my bash script and hence nothing is written on the text file.

Can anyone please tell me why its not working when I am running through cgi script but working fine when run without a cgi script ?

EDIT: I have also tried using
but the argument still wouldn't pass.

Answer Source

In the comments to the question you wrote that the CGI script was written in CSH.

Then it's as simple as the following.


./ argX

echo 'hello,' $1

Testing script.csh

hello, argX

It it isn't what you are looking for, please clarify.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download