Passing arguments to a Magento Shell script

Using Magento Api to create shell scripts seems to be easy, but there are too many things to take into account to get the most of it. In this case, I want to explain how to pass an argument from the command line when executing a magento shell script.

You have to call the script passing the argument title and argument value:

php shellscript.php --argument_title argument_value

Then, on the script code, you can retrieve this value using from your class using:

$this->getArg('argument_title')

Leave a Reply

Your email address will not be published.