I need to complete a script which gets a username from terminal to a php script and then deletes the user's comments.

So I am wondering how the username should be read by the php script, the same way that one can read a value in a bash script.

Thanks

link|improve this question

54% accept rate
What do you want to achieve? Pass the script a user name on the command line or have the script asking you for the user name while it's running. If it's not to many users you could also show a list of users and let the administrator choose. Of course this options do not exclude each other. – BetaRide Dec 20 '11 at 7:34
feedback

2 Answers

there is an example command in the drush directory : http://drupalcode.org/project/drush.git/blob/refs/heads/7.x-4.x:/examples/sandwich.drush.inc

in the command hook you define your arguments and those are then passed to the function that implements the command

link|improve this answer
feedback

If you implement a drush command, you can call that via the command line and define arguments and switches.

You can easily then hook into drupal. as your function can run from a bootstrapped drupal instance.

link|improve this answer
I know that I should use drush. The problem is that how to define the STD input in the php/drush script. – alfish Aug 21 '11 at 23:28
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.