#!/usr/bin/env drush-script

Events happening in the community are now at Drupal community events on www.drupal.org.
okokokok's picture

I want my drush scripts to be executable (without typing drush php-script NAMEOFSCRIPT.php) so I created a file /usr/local/bin/drush-script: drush php-script $1

chmod +x NAMEOFSCRIPT.php

and NAMEOFSCRIPT.php now starts with #!/usr/bin/env drush-script

Now it would be nice to get rid of the drush-script file. Unfortunately #!/usr/bin/env drush php-script doesn't work as it will look for the file 'drush php-script' instead of passing php-script as the first parameter. Is there a way to pass this parameter in some other way?

Comments

Take a look at "drush cli"

greg.1.anderson's picture

If you use the drush cli command in drush 3.0 stable, you will enter a new bash subshell where every drush command has been aliased as a shell function, so you may then just type "sql-conf" instead of "drush sql-conf".

For making aliases to your own drush-script commands, try this:

alias myscript="drush php-script myscript.php"

Then you can run 'myscript' with no args and no prefix.

drush

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: